Commit a30decb8 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Merge branch 'wrap_output' into 'master'

Wrap output of INCLUSION

See merge request giacomo.mulas/np_tmcode!76
parents 6b35584c c8807073
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ sanity_stage:
      - building_stage
   artifacts:
      paths:
         - build/testing/valgrind.log
         - build/testing/valgrind_*.log
      exclude:
         - ".git*"
         - ".git/**/*"
@@ -190,14 +190,16 @@ sanity_stage:
      - cd ../testing
      - echo "Running memory sanity check for ParticleDescriptor"
      - chmod +x test_ParticleDescriptor
      - valgrind --leak-check=full --log-file=valgrind.log ./test_ParticleDescriptor
      - grep "0 errors from 0 contexts" valgrind.log
      - valgrind --leak-check=full --log-file=valgrind_Particle.log ./test_ParticleDescriptor
      - grep "0 errors from 0 contexts" valgrind_Particle.log
      - echo "Running memory sanity check for output classes"
      - chmod +x test_outputs
      - rm valgrind.log
      - valgrind --leak-check=full --log-file=valgrind.log ./test_outputs
      - grep "0 errors from 0 contexts" valgrind.log
      - chmod +x test_cluster_outputs
      - valgrind --leak-check=full --log-file=valgrind_cluster.log ./test_cluster_outputs
      - grep "0 errors from 0 contexts" valgrind_cluster.log
      - rm -rf c_OCLU_24
      - chmod +x test_inclusion_outputs
      - valgrind --leak-check=full --log-file=valgrind_inclusion.log ./test_inclusion_outputs
      - grep "0 errors from 0 contexts" valgrind_inclusion.log
      
running_stage:
   stage: run
@@ -294,10 +296,16 @@ testing_stage:
      - export FFILE=../../test_data/cluster/OCLU_48
      - python3 ../../src/scripts/pycompare.py --no-progress --ffile $FFILE --cfile c_OCLU --html=pycompare_48.html
      - cd ../testing
      - echo "Checking consistency of HDF5 output"
      - chmod u+x test_outputs
      - ./test_outputs
      - echo "Checking consistency of HDF5 cluster output"
      - chmod u+x test_cluster_outputs
      - ./test_cluster_outputs
      - export FFILE=../../test_data/cluster/OCLU_24
      - python3 ../../src/scripts/pycompare.py --no-progress --ffile $FFILE --cfile c_OCLU_24
      - rm -rf c_OCLU_24
      - echo "Checking consistency of HDF5 incluson output"
      - chmod u+x test_inclusion_outputs
      - ./test_inclusion_outputs
      - export FFILE=../../test_data/inclusion/OINCLU
      - python3 ../../src/scripts/pycompare.py --no-progress --ffile $FFILE --cfile c_OINCLU
      - rm -rf c_OINCLU
      
 No newline at end of file
+7 −4
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@ NP_SPHERE_BINS=sphere/np_sphere
NP_TRAPPING_SRCS=../src/trapping/np_trapping.cpp ../src/trapping/cfrfme.cpp ../src/trapping/clffft.cpp
NP_TRAPPING_OBJS=../src/trapping/np_trapping.o ../src/trapping/cfrfme.o ../src/trapping/clffft.o
NP_TRAPPING_BINS=trapping/np_trapping
NP_TESTING_OBJS=../src/testing/test_outputs.o ../src/testing/test_ParticleDescriptor.o ../src/testing/test_TEDF.o ../src/testing/test_TTMS.o
NP_TESTING_BINS=testing/test_outputs testing/test_ParticleDescriptor testing/test_TEDF testing/test_TTMS
NP_TESTING_OBJS=../src/testing/test_cluster_outputs.o ../src/testing/test_inclusion_outputs.o ../src/testing/test_ParticleDescriptor.o ../src/testing/test_TEDF.o ../src/testing/test_TTMS.o
NP_TESTING_BINS=testing/test_cluster_outputs testing/test_inclusion_outputs testing/test_ParticleDescriptor testing/test_TEDF testing/test_TTMS

all: $(NPTM_LIB) $(FORTRAN_BINS) $(NP_CLUSTER_BINS) $(NP_INCLUSION_BINS) $(NP_SPHERE_BINS) $(NP_TRAPPING_BINS) $(NP_TESTING_BINS)

@@ -83,8 +83,11 @@ trapping/np_trapping: $(NPTM_LIB) $(NP_TRAPPING_OBJS)
testing/test_ParticleDescriptor: $(NPTM_LIB) ../src/testing/test_ParticleDescriptor.o
	$(CXX) $(CXXFLAGS) ../src/testing/test_ParticleDescriptor.o -o $@ $(CXXLDFLAGS)

testing/test_outputs: $(NPTM_LIB) ../src/testing/test_outputs.o
	$(CXX) $(CXXFLAGS) ../src/testing/test_outputs.o -o $@ $(CXXLDFLAGS)
testing/test_cluster_outputs: $(NPTM_LIB) ../src/testing/test_cluster_outputs.o
	$(CXX) $(CXXFLAGS) ../src/testing/test_cluster_outputs.o -o $@ $(CXXLDFLAGS)

testing/test_inclusion_outputs: $(NPTM_LIB) ../src/testing/test_inclusion_outputs.o
	$(CXX) $(CXXFLAGS) ../src/testing/test_inclusion_outputs.o -o $@ $(CXXLDFLAGS)

testing/test_TEDF: $(NPTM_LIB) ../src/testing/test_TEDF.o
	$(CXX) $(CXXFLAGS) ../src/testing/test_TEDF.o -o $@ $(CXXLDFLAGS)
+10 −7
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ using namespace std;
 *  \param gconf: `GeometryConfiguration *` Pointer to a `GeometryConfiguration` object.
 *  \param sa: `ScatteringAngles *` Pointer to a `ScatteringAngles` object.
 *  \param cid: `ClusterIterationData *` Pointer to a `ClusterIterationData` object.
 *  \param output: `ClusterOutputInfo *` Pointer to a `ClusterOutputInfo` object.
 *  \param oi: `ClusterOutputInfo *` Pointer to a `ClusterOutputInfo` object.
 *  \param output_path: `const string &` Path to the output directory.
 *  \param vtppoanp: `VirtualBinaryFile *` Pointer to a `VirtualBinaryFile` object.
 */
@@ -326,6 +326,9 @@ void cluster(const string& config_file, const string& data_file, const string& o
	return;
      }

      //==================================================
      // do the first outputs here, so that I open here the new files, afterwards I only append
      //==================================================
      vtppoanp->write_to_disk(output_path + "/c_TPPOAN");
      delete vtppoanp;

@@ -420,8 +423,8 @@ void cluster(const string& config_file, const string& data_file, const string& o
	  // the parallel loop over MPI processes covers a different set of indices for each thread
#pragma omp barrier
	  int myjxi488 = ixi488+myompthread;
	  vtppoanp_2 = new VirtualBinaryFile();
	  // each thread opens new virtual files and stores their pointers in the shared array
	  vtppoanp_2 = new VirtualBinaryFile();
	  // each thread puts a copy of the pointers to its virtual files in the shared arrays
	  vtppoanarray[myompthread] = vtppoanp_2;
#pragma omp barrier
@@ -1150,7 +1153,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
		output->vec_qschuc2[jindex - 1] = qschum;
		output->vec_pschuc2[jindex - 1] = pschum;
		output->vec_s0magc2[jindex - 1] = s0magm;
	      }
	      } // ipol polarization switch
	      if (ilr210 == 1 && jlr == 2) {
		output->vec_fsac11[jindex - 1] = cid->c1->fsacm[0][0];
		output->vec_fsac21[jindex - 1] = cid->c1->fsacm[1][0];
@@ -1489,14 +1492,14 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
	    }
	    // label 318
	    for (int i = 0; i < 4; i++) {
	      oindex = 16 * (jindex - 1) + 4 * i;
	      oindex = 16 * (jindex - 1) + 4 * i; // if IAVM fails, try adding directions
	      output->vec_dir_mulc[oindex] = cid->cmul[i][0];
	      output->vec_dir_mulc[oindex + 1] = cid->cmul[i][1];
	      output->vec_dir_mulc[oindex + 2] = cid->cmul[i][2];
	      output->vec_dir_mulc[oindex + 3] = cid->cmul[i][3];
	    }
	    for (int i = 0; i < 4; i++) {
	      oindex = 16 * (jindex - 1) + 4 * i;
	      oindex = 16 * (jindex - 1) + 4 * i; // if IAVM fails, try adding directions
	      output->vec_dir_mulclr[oindex] = cid->cmullr[i][0];
	      output->vec_dir_mulclr[oindex + 1] = cid->cmullr[i][1];
	      output->vec_dir_mulclr[oindex + 2] = cid->cmullr[i][2];
+3 −2
Original line number Diff line number Diff line
@@ -39,8 +39,9 @@ using namespace std;
 * \param maxrefiters: `int &` Reference to the maximum number of refinement iterations.
 * \param accuracygoal: `double &` Reference to the requested accuracy level.
 * \param refinemode: `int` Flag for refinement mode selection.
 * \param max_size: `np_int` The maximum expected size (required by some call-backs,
 * optional, defaults to 0).
 * \param output_path: `const string &` Path where the output needs to be placed.
 * \param jxi488: `int` Index of the current wavelength calculation.
 * \param max_size: `np_int` The maximum expected size (required by some call-backs, optional, defaults to 0).
 * \param target_device: `int` ID of target GPU, if available (defaults to 0).
 */
void invert_matrix(dcomplex **mat, np_int size, int &ier, int &maxrefiters, double &accuracygoal, int refinemode, const string& output_path, int jxi488, np_int max_size=0, int target_device=0);
+10 −3
Original line number Diff line number Diff line
@@ -59,20 +59,27 @@ void magma_zinvert1(dcomplex * &inva, np_int n, int &jer, int device_id);
 * \param accuracygoal: `double &` Accuracy to achieve in iterative refinement, defined as the module of the maximum difference between the identity matrix and the matrix product of the (approximate) inverse times the original matrix. On return, it contains the actually achieved accuracy.
 * \param refinemode: `int` Flag to control the refinement mode.
 * \param device_id: `int` ID of the device for matrix inversion offloading.
 * \param output_path: `const string &` Path where the output needs to be placed.
 * \param jxi488: `int` Index of the current wavelength calculation.
 */
void magma_zinvert_and_refine(dcomplex **mat, np_int n, int &jer, int &maxrefiters, double &accuracygoal, int refinemode, int device_id, const string& output_path, int jxi488);

/*! \brief apply iterative refinement of the solution of a matrix inversion
/*! \brief Apply iterative refinement of the solution of a matrix inversion.
 *
 * iteratively compute and apply a correction to the inverse inva of the complex matrix aorig, for a maximum number of maxiters times, or until achieving a maximum residual better than accuracygoal
 * Iteratively compute and apply a correction to the inverse `inva` of the complex
 * matrix `aorig`, for a maximum number of `maxiters` times, or until achieving a
 * maximum residual better than `accuracygoal`.
 *
 * \param aorig: pointer to the first element of the matrix of complex to be inverted.
 * \param inva: pointer to the first element of inverse.
 * \param n: `np_int` The number of rows and columns of the [n x n] matrices.
 * \param jer: `int &` Reference to an integer return flag.
 * \param maxrefiters: `int` Maximum number of refinement iterations to apply.
 * \param accuracygoal: `double` Accuracy to achieve in iterative refinement, defined as the module of the maximum difference between the identity matrix and the matrix product of the (approximate) inverse times the original matrix. On return, it contains the actually achieved accuracy
 * \param accuracygoal: `double` Accuracy to achieve in iterative refinement, defined as the module of the maximum difference between the identity matrix and the matrix product of the (approximate) inverse times the original matrix. On return, it contains the actually achieved accuracy.
 * \param refinemode: `int` Flag for refinement mode selection.
 * \param device_id: `int` ID of the device for matrix inversion offloading.
 * \param output_path: `const string &` Path where the output needs to be placed.
 * \param jxi488: `int` Index of the current wavelength calculation.
 */
void magma_refine(dcomplex *aorig, dcomplex *inva, np_int n, int &jer, int &maxrefiters, double &accuracygoal, int refinemode, int device_id, const string& output_path, int jxi488);

Loading