Commit 1361dec8 authored by Giacomo Mulas's avatar Giacomo Mulas
Browse files

Merge branch 'containers-m10' into 'master'

Containers m10

See merge request giacomo.mulas/np_tmcode!83
parents b83b2836 4a0cee1d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
# CI pipeline configuration

default:
   image: debian:trixie
   image: gmulas/np-tmcode
   #image: debian:trixie

# Switch from branch pipelines to merge request pipelines when a merge request is created
workflow:
+18 −6
Original line number Diff line number Diff line
@@ -616,16 +616,18 @@ void inclusion(const string& config_file, const string& data_file, const string&
	    p_outarray[myompthread] = p_output_2;
	  } else {
	    // Thread 0 of non-zero MPI processes needs to allocate memory for the
	    // output of all threads.
	    p_output_2 = new InclusionOutputInfo(sconf, gconf, mpidata, myjxi488, ompnumthreads);
	    // output of all threads _doing something_.
	    int iterstodo = cid_2->number_of_scales - myjxi488 + 1;
	    if (iterstodo > ompnumthreads) iterstodo = ompnumthreads;
	    p_output_2 = new InclusionOutputInfo(sconf, gconf, mpidata, myjxi488, iterstodo);
	    p_outarray[0] = p_output_2;
	  }
	  int jer = inclusion_jxi488_cycle(myjxi488, sconf, gconf, p_scattering_angles, cid_2, p_output_2, output_path, vtppoanp_2);
	} else {
	  if (myompthread > 0) {
	  //if (myompthread > 0) {
	    // If there is no input for this thread, set the output pointer to NULL.
	    p_outarray[myompthread] = NULL;
	  }	  
	    //}	  
	}

#pragma omp barrier
@@ -643,8 +645,18 @@ void inclusion(const string& config_file, const string& data_file, const string&
	  // thread 0 sends the collected virtualfiles to thread 0 of MPI process 0, then deletes them
	  for (int rr=1; rr<mpidata->nprocs; rr++) {
	    if (rr == mpidata->rank) {
	      if (p_outarray[0] == NULL) {
		// signal that we are not sending anything
		int skip_flag = 1;
		MPI_Send(&skip_flag, 1, MPI_INT32_T, 0, 10, MPI_COMM_WORLD);
	      }
	      else {
		// signal that we are sending something
		int skip_flag = 0;
		MPI_Send(&skip_flag, 1, MPI_INT32_T, 0, 10, MPI_COMM_WORLD);
		p_outarray[0]->mpisend(mpidata);
		delete p_outarray[0];
	      }
	      vtppoanarray[0]->mpisend(mpidata);
	      delete vtppoanarray[0];
	    }
+234 −224
Original line number Diff line number Diff line
@@ -4485,9 +4485,13 @@ int InclusionOutputInfo::write_legacy(const std::string &output) {
#ifdef MPI_VERSION
int InclusionOutputInfo::mpireceive(const mixMPI* mpidata, int pid) {
  int result = 0;
  int skip_flag;
  int chk_nsph, chk_inpol, chk_iavm, chk_isam, chk_num_theta, chk_num_thetas;
  int chk_num_phi, chk_num_phis, chk_ndirs, chk_idfc, chk_configs;
  double chk_exri;
  MPI_Recv(&skip_flag, 1, MPI_INT32_T, pid, 10, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
  // Proceed with the rest _only if__ skip_flag==0, else nothing is to be received
  if (skip_flag == 0) {
    MPI_Recv(&chk_nsph, 1, MPI_INT32_T, pid, 10, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
    MPI_Recv(&chk_inpol, 1, MPI_INT32_T, pid, 10, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
    MPI_Recv(&chk_iavm, 1, MPI_INT32_T, pid, 10, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
@@ -4637,6 +4641,7 @@ int InclusionOutputInfo::mpireceive(const mixMPI* mpidata, int pid) {
    }  else {
      MPI_Send(&result, 1, MPI_INT32_T, pid, 10, MPI_COMM_WORLD);
    }
  }
  return result;
}

@@ -5741,9 +5746,13 @@ int SphereOutputInfo::write_legacy(const std::string &file_name) {
#ifdef MPI_VERSION
int SphereOutputInfo::mpireceive(const mixMPI *mpidata, int pid) {
  int result = 0;
  int skip_flag;
  int chk_nsph, chk_inpol, chk_isam, chk_num_theta, chk_num_thetas;
  int chk_num_phi, chk_num_phis, chk_ndirs, chk_idfc, chk_configs;
  double chk_exri;
  MPI_Recv(&skip_flag, 1, MPI_INT32_T, pid, 10, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
  // Proceed with the rest _only if__ skip_flag==0, else nothing is to be received
  if (skip_flag == 0) {
    MPI_Recv(&chk_nsph, 1, MPI_INT32_T, pid, 10, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
    MPI_Recv(&chk_inpol, 1, MPI_INT32_T, pid, 10, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
    MPI_Recv(&chk_isam, 1, MPI_INT32_T, pid, 10, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
@@ -5826,6 +5835,7 @@ int SphereOutputInfo::mpireceive(const mixMPI *mpidata, int pid) {
    }  else {
      MPI_Send(&result, 1, MPI_INT32_T, pid, 10, MPI_COMM_WORLD);
    }
  }
  return result;
}

+18 −6
Original line number Diff line number Diff line
@@ -484,16 +484,18 @@ void sphere(const string& config_file, const string& data_file, const string& ou
	    p_outarray[myompthread] = p_output_2;
	  } else {
	    // Thread 0 of non-zero MPI processes needs to allocate memory for the
	    // output of all threads.
	    p_output_2 = new SphereOutputInfo(sconf, gconf, mpidata, myjxi488, ompnumthreads);
	    // output of all threads _doing something_.
	    int iterstodo = sid_2->number_of_scales - myjxi488 + 1;
	    if (iterstodo > ompnumthreads) iterstodo = ompnumthreads;
	    p_output_2 = new SphereOutputInfo(sconf, gconf, mpidata, myjxi488, iterstodo);
	    p_outarray[0] = p_output_2;
	  }
	  int jer = sphere_jxi488_cycle(myjxi488 - 1, sconf, gconf, p_sa, sid_2, p_output_2, output_path, vtppoanp_2);
	} else {
	  if (myompthread > 0) {
	  // if (myompthread > 0) {
	    // If there is no input for this thread, set the output pointer to NULL.
	    p_outarray[myompthread] = NULL;
	  }	  
	    //}	  
	}

#pragma omp barrier
@@ -511,8 +513,18 @@ void sphere(const string& config_file, const string& data_file, const string& ou
	  // thread 0 sends the collected virtualfiles to thread 0 of MPI process 0, then deletes them
	  for (int rr=1; rr<mpidata->nprocs; rr++) {
	    if (rr == mpidata->rank) {
	      if (p_outarray[0] == NULL) {
		// signal that we are not sending anything
		int skip_flag = 1;
		MPI_Send(&skip_flag, 1, MPI_INT32_T, 0, 10, MPI_COMM_WORLD);
	      }
	      else {
		// signal that we are sending something
		int skip_flag = 0;
		MPI_Send(&skip_flag, 1, MPI_INT32_T, 0, 10, MPI_COMM_WORLD);
		p_outarray[0]->mpisend(mpidata);
		delete p_outarray[0];
	      }
	      vtppoanarray[0]->mpisend(mpidata);
	      delete vtppoanarray[0];
	    }