Loading src/include/tfrfme.h +29 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,13 @@ public: */ std::complex<double> get_element(int index) { return wk[index]; } /*! \brief Calculate the necessary amount of memory to create a new instance. * * \param lm: `int` Maximum field expansion order. * \return size: `long` The necessary memory size in bytes. */ static long get_memory_requirement(int lm); /*! \brief Set an element in the WK vector. * * \param index: `int` Index of the desired element. Loading Loading @@ -185,6 +192,13 @@ public: */ double get_matrix_element(int row, int col) { return vkzm[row][col]; } /*! \brief Calculate the necessary amount of memory to create a new instance. * * \param _nkv: `int` Number of radial vector coordinates. QUESTION: correct? * \return size: `long` The necessary memory size in bytes. */ static long get_memory_requirement(int _nkv); /*! \brief Get a parameter by its name. * * \param param_name: `string` Name of the parameter. Loading Loading @@ -349,6 +363,21 @@ public: */ std::complex<double> get_matrix_element(int row, int col); /*! \brief Calculate the necessary amount of memory to create a new instance. * * \param _lmode: `int` Order expansion mode flag. * \param _lm: `int` Maximum field expansion order. * \param _nkv: `int` Number of radial vector coordinates. QUESTION: correct? * \param _nxv: `int` Number of computed X coordinates. * \param _nyv: `int` Number of computed Y coordinates. * \param _nzv: `int` Number of computed Z coordinates. * \return size: `long` The necessary memory size in bytes. */ static long get_memory_requirement( int _lmode, int _lm, int _nkv, int _nxv, int _nyv, int _nzv ); /*! \brief Get a configuration parameter. * * \param param_name: `string` Name of the parameter. Loading src/libnptm/tfrfme.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,12 @@ Swap1* Swap1::from_legacy(string file_name) { return instance; } long Swap1::get_memory_requirement(int lm) { long size = (long)sizeof(int); size += (long)(sizeof(complex<double>) * 2 * lm * (lm + 2)); return size; } void Swap1::write_binary(string file_name, string mode) { if (mode.compare("LEGACY") == 0) { write_legacy(file_name); Loading Loading @@ -302,6 +308,12 @@ Swap2* Swap2::from_legacy(string file_name) { return instance; } long Swap2::get_memory_requirement(int _nkv) { long size = (long)(3 * sizeof(int) + 11 * sizeof(double)); size += (long)(sizeof(double) * _nkv * (_nkv + 1)); return size; } double Swap2::get_param(string param_name) { double value; if (param_name.compare("nkv") == 0) value = 1.0 * nkv; Loading Loading @@ -711,6 +723,18 @@ std::complex<double> TFRFME::get_matrix_element(int row, int col) { return wsum[row][col]; } long TFRFME::get_memory_requirement( int _lmode, int _lm, int _nkv, int _nxv, int _nyv, int _nzv ) { int _nlmmt = 2 * _lm * (_lm + 2); int _nrvc = _nxv * _nyv * _nzv; long size = (long)(8 * sizeof(int) + 8 * sizeof(double)); size += (long)((_nxv + _nyv + _nzv) * sizeof(double)); size += (long)(_nlmmt * _nrvc * sizeof(complex<double>)); return size; } double TFRFME::get_param(string param_name) { double value; if (param_name.compare("vk") == 0) value = vk; Loading src/make.inc +2 −2 Original line number Diff line number Diff line Loading @@ -40,8 +40,8 @@ endif # CXXFLAGS defines the default compilation options for the C++ compiler ifndef CXXFLAGS #override CXXFLAGS=-O0 -ggdb -pg -coverage -I$(HDF5_INCLUDE) override CXXFLAGS=-O3 -I$(HDF5_INCLUDE) override CXXFLAGS=-O3 -ggdb -pg -coverage -I$(HDF5_INCLUDE) #override CXXFLAGS=-O3 -I$(HDF5_INCLUDE) endif # HDF5_LIB defines the default path to the HDF5 libraries to use Loading src/trapping/cfrfme.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -225,6 +225,15 @@ void frfme(string data_file, string output_path) { /*vkv = new double[nkv](); vkzm = new double*[nkv]; for (int vi = 0; vi < nkv; vi++) vkzm[vi] = new double[nkv];*/ long swap1_size, swap2_size, tfrfme_size; double size_mb; printf("INFO: calculation memory requirements\n"); swap1_size = Swap1::get_memory_requirement(lm); size_mb = 1.0 * swap1_size / 1024.0 / 1024.0; printf("Swap 1: %.2lg MB\n", size_mb); swap2_size = Swap2::get_memory_requirement(nkv); size_mb = 1.0 * swap2_size / 1024.0 / 1024.0; printf("Swap 2: %.2lg MB\n", size_mb); tt2 = new Swap2(nkv); // End of array initialization double vkm = vk * exri; Loading @@ -243,6 +252,11 @@ void frfme(string data_file, string output_path) { int nzs = nzsh * 2; int nzv = nzs + 1; int nzshpo = nzsh + 1; tfrfme_size = TFRFME::get_memory_requirement(lmode, lm, nkv, nxv, nyv, nzv); size_mb = 1.0 * tfrfme_size / 1024.0 / 1024.0; printf("TFRFME: %.2lg MB\n", size_mb); size_mb = 1.0 * (swap1_size + swap2_size + tfrfme_size) / 1024.0 / 1024.0; printf("TOTAL: %.2lg MB\n", size_mb); tfrfme = new TFRFME(lmode, lm, nkv, nxv, nyv, nzv); for (int i24 = nxshpo; i24 <= nxs; i24++) { tfrfme->set_x(i24, tfrfme->get_x(i24 - 1) + delxyz); Loading Loading
src/include/tfrfme.h +29 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,13 @@ public: */ std::complex<double> get_element(int index) { return wk[index]; } /*! \brief Calculate the necessary amount of memory to create a new instance. * * \param lm: `int` Maximum field expansion order. * \return size: `long` The necessary memory size in bytes. */ static long get_memory_requirement(int lm); /*! \brief Set an element in the WK vector. * * \param index: `int` Index of the desired element. Loading Loading @@ -185,6 +192,13 @@ public: */ double get_matrix_element(int row, int col) { return vkzm[row][col]; } /*! \brief Calculate the necessary amount of memory to create a new instance. * * \param _nkv: `int` Number of radial vector coordinates. QUESTION: correct? * \return size: `long` The necessary memory size in bytes. */ static long get_memory_requirement(int _nkv); /*! \brief Get a parameter by its name. * * \param param_name: `string` Name of the parameter. Loading Loading @@ -349,6 +363,21 @@ public: */ std::complex<double> get_matrix_element(int row, int col); /*! \brief Calculate the necessary amount of memory to create a new instance. * * \param _lmode: `int` Order expansion mode flag. * \param _lm: `int` Maximum field expansion order. * \param _nkv: `int` Number of radial vector coordinates. QUESTION: correct? * \param _nxv: `int` Number of computed X coordinates. * \param _nyv: `int` Number of computed Y coordinates. * \param _nzv: `int` Number of computed Z coordinates. * \return size: `long` The necessary memory size in bytes. */ static long get_memory_requirement( int _lmode, int _lm, int _nkv, int _nxv, int _nyv, int _nzv ); /*! \brief Get a configuration parameter. * * \param param_name: `string` Name of the parameter. Loading
src/libnptm/tfrfme.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,12 @@ Swap1* Swap1::from_legacy(string file_name) { return instance; } long Swap1::get_memory_requirement(int lm) { long size = (long)sizeof(int); size += (long)(sizeof(complex<double>) * 2 * lm * (lm + 2)); return size; } void Swap1::write_binary(string file_name, string mode) { if (mode.compare("LEGACY") == 0) { write_legacy(file_name); Loading Loading @@ -302,6 +308,12 @@ Swap2* Swap2::from_legacy(string file_name) { return instance; } long Swap2::get_memory_requirement(int _nkv) { long size = (long)(3 * sizeof(int) + 11 * sizeof(double)); size += (long)(sizeof(double) * _nkv * (_nkv + 1)); return size; } double Swap2::get_param(string param_name) { double value; if (param_name.compare("nkv") == 0) value = 1.0 * nkv; Loading Loading @@ -711,6 +723,18 @@ std::complex<double> TFRFME::get_matrix_element(int row, int col) { return wsum[row][col]; } long TFRFME::get_memory_requirement( int _lmode, int _lm, int _nkv, int _nxv, int _nyv, int _nzv ) { int _nlmmt = 2 * _lm * (_lm + 2); int _nrvc = _nxv * _nyv * _nzv; long size = (long)(8 * sizeof(int) + 8 * sizeof(double)); size += (long)((_nxv + _nyv + _nzv) * sizeof(double)); size += (long)(_nlmmt * _nrvc * sizeof(complex<double>)); return size; } double TFRFME::get_param(string param_name) { double value; if (param_name.compare("vk") == 0) value = vk; Loading
src/make.inc +2 −2 Original line number Diff line number Diff line Loading @@ -40,8 +40,8 @@ endif # CXXFLAGS defines the default compilation options for the C++ compiler ifndef CXXFLAGS #override CXXFLAGS=-O0 -ggdb -pg -coverage -I$(HDF5_INCLUDE) override CXXFLAGS=-O3 -I$(HDF5_INCLUDE) override CXXFLAGS=-O3 -ggdb -pg -coverage -I$(HDF5_INCLUDE) #override CXXFLAGS=-O3 -I$(HDF5_INCLUDE) endif # HDF5_LIB defines the default path to the HDF5 libraries to use Loading
src/trapping/cfrfme.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -225,6 +225,15 @@ void frfme(string data_file, string output_path) { /*vkv = new double[nkv](); vkzm = new double*[nkv]; for (int vi = 0; vi < nkv; vi++) vkzm[vi] = new double[nkv];*/ long swap1_size, swap2_size, tfrfme_size; double size_mb; printf("INFO: calculation memory requirements\n"); swap1_size = Swap1::get_memory_requirement(lm); size_mb = 1.0 * swap1_size / 1024.0 / 1024.0; printf("Swap 1: %.2lg MB\n", size_mb); swap2_size = Swap2::get_memory_requirement(nkv); size_mb = 1.0 * swap2_size / 1024.0 / 1024.0; printf("Swap 2: %.2lg MB\n", size_mb); tt2 = new Swap2(nkv); // End of array initialization double vkm = vk * exri; Loading @@ -243,6 +252,11 @@ void frfme(string data_file, string output_path) { int nzs = nzsh * 2; int nzv = nzs + 1; int nzshpo = nzsh + 1; tfrfme_size = TFRFME::get_memory_requirement(lmode, lm, nkv, nxv, nyv, nzv); size_mb = 1.0 * tfrfme_size / 1024.0 / 1024.0; printf("TFRFME: %.2lg MB\n", size_mb); size_mb = 1.0 * (swap1_size + swap2_size + tfrfme_size) / 1024.0 / 1024.0; printf("TOTAL: %.2lg MB\n", size_mb); tfrfme = new TFRFME(lmode, lm, nkv, nxv, nyv, nzv); for (int i24 = nxshpo; i24 <= nxs; i24++) { tfrfme->set_x(i24, tfrfme->get_x(i24 - 1) + delxyz); Loading