Loading .gitlab-ci.yml +3 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,9 @@ testing_stage: - python3 ../../src/scripts/pycompare.py --ffile=$FFILE --cfile=c_OCLU --html - echo "Testing cluster with 24 spheres" - ./np_cluster ../../test_data/cluster/DEDFB_24 ../../test_data/cluster/DCLU_24 . - echo "Comparing output of CLUSTER with 24 spheres" - export FFILE=../../test_data/cluster/OCLU_24 - python3 ../../src/scripts/pycompare.py --ffile=$FFILE --cfile=c_OCLU --html - echo "Checking consistency among legacy and HDF5 configuration files" - ../testing/test_TEDF ../../test_data/cluster/DEDFB_24 c_TEDF c_TEDF.hd5 - echo "Checking consistency among legacy and HDF5 TM files" Loading src/cluster/cluster.cpp +16 −4 Original line number Diff line number Diff line Loading @@ -37,6 +37,14 @@ #include "../include/lapack_calls.h" #endif #ifndef INCLUDE_ALGEBRAIC_H_ #include "../include/algebraic.h" #endif #ifdef LAPACK_ILP64 #define USE_LAPACK #endif using namespace std; /*! \brief C++ implementation of CLU Loading Loading @@ -71,7 +79,7 @@ void cluster(string config_file, string data_file, string output_path) { if (sconf->number_of_spheres == gconf->number_of_spheres) { // Shortcuts to variables stored in configuration objects int nsph = gconf->number_of_spheres; int mxndm = gconf->mxndm; lapack_int mxndm = (lapack_int)gconf->mxndm; int inpol = gconf->in_pol; int npnt = gconf->npnt; int npntts = gconf->npntts; Loading Loading @@ -273,6 +281,11 @@ void cluster(string config_file, string data_file, string output_path) { string tppoan_name = output_path + "/c_TPPOAN"; tppoan.open(tppoan_name.c_str(), ios::out | ios::binary); if (tppoan.is_open()) { #ifdef USE_LAPACK printf("INFO: should use LAPACK calls.\n"); #else printf("INFO: should use fall-back lucin() calls.\n"); #endif tppoan.write(reinterpret_cast<char *>(&iavm), sizeof(int)); tppoan.write(reinterpret_cast<char *>(&isam), sizeof(int)); tppoan.write(reinterpret_cast<char *>(&inpol), sizeof(int)); Loading Loading @@ -340,10 +353,9 @@ void cluster(string config_file, string data_file, string output_path) { if (jer != 0) break; } // i132 loop cms(am, c1, c1ao, c4, c6); //cms(tam, c1, c1ao, c4, c6); lapack_int ndit = 2 * nsph * c4->nlim; //lucin(am, mxndm, ndit, jer); zinvert(am, ndit, jer); invert_matrix(am, ndit, jer, mxndm); //zinvert(am, ndit, jer); if (jer != 0) break; // jxi488 loop: goes to memory clean ztm(am, c1, c1ao, c4, c6, c9); if (sconf->idfc >= 0) { Loading src/include/algebraic.h 0 → 100644 +30 −0 Original line number Diff line number Diff line /*! \file algebraic.h * * \brief Declaration of algebraic functions with different call-backs. * * In principle, the system that runs NP_TMcode may offer various types of * optimized features, such as multi-core or multi-node scaling, GPU offload, * or external libraries. This header collects a set of functions that can * perform standard algebraic operations choosing the most optimized available * system as a call-back. If no optimization is detected, eventually the * legacy serial function implementation is used as a fall-back. */ #ifndef lapack_int #define lapack_int int64_t #endif #ifndef INCLUDE_ALGEBRAIC_H_ #define INCLUDE_ALGEBRAIC_H_ /*! \brief Perform in-place matrix inversion. * * \param mat: Matrix of complex. The matrix to be inverted (must be a square matrix). * \param size: `lapack_int` The size of the matrix (i.e. the number of its rows or columns). * \param ier: `int &` Reference to an integer variable for returning a result flag. * \param max_size: `lapack_int` The maximum expected size (required by some call-backs, * optional, defaults to 0). */ void invert_matrix(std::complex<double> **mat, lapack_int size, int &ier, lapack_int max_size=0); #endif src/include/clu_subs.h +3 −3 Original line number Diff line number Diff line Loading @@ -154,11 +154,11 @@ void hjv( * LU decomposition. See Eq. (5.29) in Borghese, Denti & Saija (2007). * * \param am: Matrix of complex. * \param nddmst: `const int` * \param n: `int` * \param nddmst: `const int64_t` * \param n: `int64_t` * \param ier: `int &` */ void lucin(std::complex<double> **am, const int nddmst, int n, int &ier); void lucin(std::complex<double> **am, const int64_t nddmst, int64_t n, int &ier); /*! \brief Compute the average extinction cross-section. * Loading src/libnptm/Makefile +3 −3 Original line number Diff line number Diff line Loading @@ -19,11 +19,11 @@ endif include ../make.inc CXX_NPTM_OBJS=$(OBJDIR)/Commons.o $(OBJDIR)/Configuration.o $(OBJDIR)/file_io.o $(OBJDIR)/Parsers.o $(OBJDIR)/sph_subs.o $(OBJDIR)/clu_subs.o $(OBJDIR)/tfrfme.o $(OBJDIR)/tra_subs.o $(OBJDIR)/TransitionMatrix.o $(OBJDIR)/lapack_calls.o CXX_NPTM_OBJS=$(OBJDIR)/Commons.o $(OBJDIR)/Configuration.o $(OBJDIR)/file_io.o $(OBJDIR)/Parsers.o $(OBJDIR)/sph_subs.o $(OBJDIR)/clu_subs.o $(OBJDIR)/tfrfme.o $(OBJDIR)/tra_subs.o $(OBJDIR)/TransitionMatrix.o $(OBJDIR)/lapack_calls.o $(OBJDIR)/algebraic.o CXX_NPTM_DYNOBJS=$(DYNOBJDIR)/Commons.o $(DYNOBJDIR)/Configuration.o $(DYNOBJDIR)/file_io.o $(DYNOBJDIR)/Parsers.o $(DYNOBJDIR)/sph_subs.o $(DYNOBJDIR)/clu_subs.o $(DYNOBJDIR)/tfrfme.o $(DYNOBJDIR)/tra_subs.o $(DYNOBJDIR)/TransitionMatrix.o $(DYNOBJDIR)/lapack_calls.o CXX_NPTM_DYNOBJS=$(DYNOBJDIR)/Commons.o $(DYNOBJDIR)/Configuration.o $(DYNOBJDIR)/file_io.o $(DYNOBJDIR)/Parsers.o $(DYNOBJDIR)/sph_subs.o $(DYNOBJDIR)/clu_subs.o $(DYNOBJDIR)/tfrfme.o $(DYNOBJDIR)/tra_subs.o $(DYNOBJDIR)/TransitionMatrix.o $(DYNOBJDIR)/lapack_calls.o $(DYNOBJDIR)/algebraic.o CXX_NPTM_DEBUG=$(OBJDIR)/Commons.g* $(OBJDIR)/Configuration.g* $(OBJDIR)/file_io.g* $(OBJDIR)/Parsers.g* $(OBJDIR)/sph_subs.g* $(OBJDIR)/clu_subs.g* $(OBJDIR)/tfrfme.g* $(OBJDIR)/tra_subs.g* $(OBJDIR)/TransitionMatrix.g* $(OBJDIR)/lapack_calls.g* CXX_NPTM_DEBUG=$(OBJDIR)/Commons.g* $(OBJDIR)/Configuration.g* $(OBJDIR)/file_io.g* $(OBJDIR)/Parsers.g* $(OBJDIR)/sph_subs.g* $(OBJDIR)/clu_subs.g* $(OBJDIR)/tfrfme.g* $(OBJDIR)/tra_subs.g* $(OBJDIR)/TransitionMatrix.g* $(OBJDIR)/lapack_calls.g* $(OBJDIR)/algebraic.g* all: $(BUILDDIR_NPTM)/libnptm.a $(BUILDDIR_NPTM)/libnptm.so Loading Loading
.gitlab-ci.yml +3 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,9 @@ testing_stage: - python3 ../../src/scripts/pycompare.py --ffile=$FFILE --cfile=c_OCLU --html - echo "Testing cluster with 24 spheres" - ./np_cluster ../../test_data/cluster/DEDFB_24 ../../test_data/cluster/DCLU_24 . - echo "Comparing output of CLUSTER with 24 spheres" - export FFILE=../../test_data/cluster/OCLU_24 - python3 ../../src/scripts/pycompare.py --ffile=$FFILE --cfile=c_OCLU --html - echo "Checking consistency among legacy and HDF5 configuration files" - ../testing/test_TEDF ../../test_data/cluster/DEDFB_24 c_TEDF c_TEDF.hd5 - echo "Checking consistency among legacy and HDF5 TM files" Loading
src/cluster/cluster.cpp +16 −4 Original line number Diff line number Diff line Loading @@ -37,6 +37,14 @@ #include "../include/lapack_calls.h" #endif #ifndef INCLUDE_ALGEBRAIC_H_ #include "../include/algebraic.h" #endif #ifdef LAPACK_ILP64 #define USE_LAPACK #endif using namespace std; /*! \brief C++ implementation of CLU Loading Loading @@ -71,7 +79,7 @@ void cluster(string config_file, string data_file, string output_path) { if (sconf->number_of_spheres == gconf->number_of_spheres) { // Shortcuts to variables stored in configuration objects int nsph = gconf->number_of_spheres; int mxndm = gconf->mxndm; lapack_int mxndm = (lapack_int)gconf->mxndm; int inpol = gconf->in_pol; int npnt = gconf->npnt; int npntts = gconf->npntts; Loading Loading @@ -273,6 +281,11 @@ void cluster(string config_file, string data_file, string output_path) { string tppoan_name = output_path + "/c_TPPOAN"; tppoan.open(tppoan_name.c_str(), ios::out | ios::binary); if (tppoan.is_open()) { #ifdef USE_LAPACK printf("INFO: should use LAPACK calls.\n"); #else printf("INFO: should use fall-back lucin() calls.\n"); #endif tppoan.write(reinterpret_cast<char *>(&iavm), sizeof(int)); tppoan.write(reinterpret_cast<char *>(&isam), sizeof(int)); tppoan.write(reinterpret_cast<char *>(&inpol), sizeof(int)); Loading Loading @@ -340,10 +353,9 @@ void cluster(string config_file, string data_file, string output_path) { if (jer != 0) break; } // i132 loop cms(am, c1, c1ao, c4, c6); //cms(tam, c1, c1ao, c4, c6); lapack_int ndit = 2 * nsph * c4->nlim; //lucin(am, mxndm, ndit, jer); zinvert(am, ndit, jer); invert_matrix(am, ndit, jer, mxndm); //zinvert(am, ndit, jer); if (jer != 0) break; // jxi488 loop: goes to memory clean ztm(am, c1, c1ao, c4, c6, c9); if (sconf->idfc >= 0) { Loading
src/include/algebraic.h 0 → 100644 +30 −0 Original line number Diff line number Diff line /*! \file algebraic.h * * \brief Declaration of algebraic functions with different call-backs. * * In principle, the system that runs NP_TMcode may offer various types of * optimized features, such as multi-core or multi-node scaling, GPU offload, * or external libraries. This header collects a set of functions that can * perform standard algebraic operations choosing the most optimized available * system as a call-back. If no optimization is detected, eventually the * legacy serial function implementation is used as a fall-back. */ #ifndef lapack_int #define lapack_int int64_t #endif #ifndef INCLUDE_ALGEBRAIC_H_ #define INCLUDE_ALGEBRAIC_H_ /*! \brief Perform in-place matrix inversion. * * \param mat: Matrix of complex. The matrix to be inverted (must be a square matrix). * \param size: `lapack_int` The size of the matrix (i.e. the number of its rows or columns). * \param ier: `int &` Reference to an integer variable for returning a result flag. * \param max_size: `lapack_int` The maximum expected size (required by some call-backs, * optional, defaults to 0). */ void invert_matrix(std::complex<double> **mat, lapack_int size, int &ier, lapack_int max_size=0); #endif
src/include/clu_subs.h +3 −3 Original line number Diff line number Diff line Loading @@ -154,11 +154,11 @@ void hjv( * LU decomposition. See Eq. (5.29) in Borghese, Denti & Saija (2007). * * \param am: Matrix of complex. * \param nddmst: `const int` * \param n: `int` * \param nddmst: `const int64_t` * \param n: `int64_t` * \param ier: `int &` */ void lucin(std::complex<double> **am, const int nddmst, int n, int &ier); void lucin(std::complex<double> **am, const int64_t nddmst, int64_t n, int &ier); /*! \brief Compute the average extinction cross-section. * Loading
src/libnptm/Makefile +3 −3 Original line number Diff line number Diff line Loading @@ -19,11 +19,11 @@ endif include ../make.inc CXX_NPTM_OBJS=$(OBJDIR)/Commons.o $(OBJDIR)/Configuration.o $(OBJDIR)/file_io.o $(OBJDIR)/Parsers.o $(OBJDIR)/sph_subs.o $(OBJDIR)/clu_subs.o $(OBJDIR)/tfrfme.o $(OBJDIR)/tra_subs.o $(OBJDIR)/TransitionMatrix.o $(OBJDIR)/lapack_calls.o CXX_NPTM_OBJS=$(OBJDIR)/Commons.o $(OBJDIR)/Configuration.o $(OBJDIR)/file_io.o $(OBJDIR)/Parsers.o $(OBJDIR)/sph_subs.o $(OBJDIR)/clu_subs.o $(OBJDIR)/tfrfme.o $(OBJDIR)/tra_subs.o $(OBJDIR)/TransitionMatrix.o $(OBJDIR)/lapack_calls.o $(OBJDIR)/algebraic.o CXX_NPTM_DYNOBJS=$(DYNOBJDIR)/Commons.o $(DYNOBJDIR)/Configuration.o $(DYNOBJDIR)/file_io.o $(DYNOBJDIR)/Parsers.o $(DYNOBJDIR)/sph_subs.o $(DYNOBJDIR)/clu_subs.o $(DYNOBJDIR)/tfrfme.o $(DYNOBJDIR)/tra_subs.o $(DYNOBJDIR)/TransitionMatrix.o $(DYNOBJDIR)/lapack_calls.o CXX_NPTM_DYNOBJS=$(DYNOBJDIR)/Commons.o $(DYNOBJDIR)/Configuration.o $(DYNOBJDIR)/file_io.o $(DYNOBJDIR)/Parsers.o $(DYNOBJDIR)/sph_subs.o $(DYNOBJDIR)/clu_subs.o $(DYNOBJDIR)/tfrfme.o $(DYNOBJDIR)/tra_subs.o $(DYNOBJDIR)/TransitionMatrix.o $(DYNOBJDIR)/lapack_calls.o $(DYNOBJDIR)/algebraic.o CXX_NPTM_DEBUG=$(OBJDIR)/Commons.g* $(OBJDIR)/Configuration.g* $(OBJDIR)/file_io.g* $(OBJDIR)/Parsers.g* $(OBJDIR)/sph_subs.g* $(OBJDIR)/clu_subs.g* $(OBJDIR)/tfrfme.g* $(OBJDIR)/tra_subs.g* $(OBJDIR)/TransitionMatrix.g* $(OBJDIR)/lapack_calls.g* CXX_NPTM_DEBUG=$(OBJDIR)/Commons.g* $(OBJDIR)/Configuration.g* $(OBJDIR)/file_io.g* $(OBJDIR)/Parsers.g* $(OBJDIR)/sph_subs.g* $(OBJDIR)/clu_subs.g* $(OBJDIR)/tfrfme.g* $(OBJDIR)/tra_subs.g* $(OBJDIR)/TransitionMatrix.g* $(OBJDIR)/lapack_calls.g* $(OBJDIR)/algebraic.g* all: $(BUILDDIR_NPTM)/libnptm.a $(BUILDDIR_NPTM)/libnptm.so Loading