Julien Dehos il y a 6 ans
commit
d763370999
6 fichiers modifiés avec 93 ajouts et 0 suppressions
  1. 3 0
      .gitignore
  2. 7 0
      Makefile
  3. 36 0
      README.md
  4. 16 0
      modules/armadillo
  5. 10 0
      oar.sh
  6. 21 0
      test.cpp

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+.*~
+test.out
+test-context.out

+ 7 - 0
Makefile

@@ -0,0 +1,7 @@
+CXXFLAGS = -std=c++11 `pkg-config --cflags armadillo`
+LDFLAGS = `pkg-config --libs armadillo`
+
+all: test.out 
+
+%.out: %.cpp
+	$(CXX) $(CXXFLAGS) -o $@ $(LDFLAGS) $< 

+ 36 - 0
README.md

@@ -0,0 +1,36 @@
+
+utiliser armadillo sur calculco :
+
+```
+ml purge
+
+# installer armadillo en local
+mkdir -p ~/tmp
+cd ~/tmp
+wget https://downloads.sourceforge.net/project/arma/armadillo-7.960.1.tar.xz
+tar xf armadillo-7.960.1.tar.xz
+cd armadillo-7.960.1/
+mkdir build
+cd build
+cmake -DCMAKE_INSTALL_PREFIX=~/opt/armadillo -DDETECT_HDF5=ON ..
+make -j16 install
+
+# installer le module
+cd ~/tmp
+git clone https://gogs.univ-littoral.fr/jdehos/test_armadillo
+cd test_armadillo
+cp -R modules ~/opt/armadillo/
+
+# tester un code armadillo (sur la frontale)
+module use ~/opt/armadillo/modules
+module load armadillo 
+cd ~/tmp/test_armadillo
+make
+./test.out
+
+# lancer un code armadillo sur un noeud
+cd ~/tmp/test_armadillo
+make
+oarsub -S ./oar.sh
+```
+

+ 16 - 0
modules/armadillo

@@ -0,0 +1,16 @@
+#%Module -*- tcl -*-
+
+proc ModulesHelp { } {
+        puts stderr "armadillo" 
+}
+
+module-whatis "C++ linear algebra library"
+
+set          ARMA_ROOT       "$::env(HOME)/opt/armadillo"
+
+append-path  CPATH            $ARMA_ROOT/include
+append-path  PATH             $ARMA_ROOT/bin
+append-path  LD_LIBRARY_PATH  $ARMA_ROOT/lib
+append-path  LIBRARY_PATH     $ARMA_ROOT/lib
+append-path  PKG_CONFIG_PATH  $ARMA_ROOT/lib/pkgconfig
+

+ 10 - 0
oar.sh

@@ -0,0 +1,10 @@
+#!/bin/sh
+
+#OAR -l /core=1,walltime=01:00:00
+
+. /nfs/opt/env/env.sh
+module use ~/opt/armadillo/modules
+module load armadillo 
+
+./test.out > out_test.txt 
+

+ 21 - 0
test.cpp

@@ -0,0 +1,21 @@
+#include <armadillo>
+#include <iostream>
+
+using namespace std;
+
+int main() 
+{
+    arma::mat U, V, X = arma::randu<arma::mat>(5, 5);
+    arma::vec s;
+    arma::svd(U,s,V,X);
+
+    cout << U << endl << endl;
+    cout << s << endl << endl;
+    cout << V << endl << endl;
+    cout << X << endl << endl;
+
+    s.save("s.hdf5", arma::hdf5_binary);
+
+    return 0;
+}
+