Commit 487de478 authored by Mulas, Giacomo's avatar Mulas, Giacomo
Browse files

make (somewhat) parallel also raba()

push the first iteration on wavelength at the same OMP nested level as the others
parent 4719d200
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -298,7 +298,15 @@ void cluster(const string& config_file, const string& data_file, const string& o
#ifdef USE_NVTX
      nvtxRangePush("First iteration");
#endif
      int jer = cluster_jxi488_cycle(jxi488, sconf, gconf, p_scattering_angles, cid, p_output, output_path, vtppoanp);
      // use these pragmas, which should have no effect on parallelism, just to push OMP nested levels at the same level also in the first wavelength iteration
      int jer = 0;
#pragma omp parallel
      {
#pragma omp single
	{
	  jer = cluster_jxi488_cycle(jxi488, sconf, gconf, p_scattering_angles, cid, p_output, output_path, vtppoanp);
	}
      }
#ifdef USE_NVTX
      nvtxRangePop();
#endif
+25 −13
Original line number Diff line number Diff line
@@ -95,10 +95,13 @@ C1::C1(GeometryConfiguration *gconf, ScattererConfiguration *sconf) {
  }

  sas = new dcomplex**[nsph];
  for (int si = 0; si < nsph; si++) {
    sas[si] = new dcomplex*[2];
    sas[si][0] = new dcomplex[2]();
    sas[si][1] = new dcomplex[2]();
  sas[0] = new dcomplex*[nsph*2];
  sas[0][0] = new dcomplex[nsph*2*2];
  sas[0][1] = sas[0][0]+2;
  for (int si = 1; si < nsph; si++) {
    sas[si] = sas[0]+2*si;
    sas[si][0] = sas[0][0]+4*si;
    sas[si][1] = sas[si][0]+2;
  }
}

@@ -162,10 +165,16 @@ C1::C1(const C1& rhs) {
  ros = new double[nsph]();

  sas = new dcomplex**[nsph];
  sas[0] = new dcomplex*[nsph*2];
  sas[0][0] = new dcomplex[nsph*2*2];
  sas[0][1] = sas[0][0]+2;
  for (int si = 1; si < nsph; si++) {
    sas[si] = sas[0]+2*si;
    sas[si][0] = sas[0][0]+4*si;
    sas[si][1] = sas[si][0]+2;
  }
  for (int si = 0; si < nsph; si++) {
    sas[si] = new dcomplex*[2];
    for (int sj=0; sj<2; sj++) {
      sas[si][sj] = new dcomplex[2]();
      for (int sk=0; sk<2; sk++) sas[si][sj][sk] = rhs.sas[si][sj][sk];
    }
    fsas[si] = rhs.fsas[si];
@@ -252,10 +261,16 @@ C1::C1(const mixMPI *mpidata) {
  MPI_Bcast(rzz, nsph, MPI_DOUBLE, 0, MPI_COMM_WORLD);
  MPI_Bcast(ros, configurations, MPI_DOUBLE, 0, MPI_COMM_WORLD);
  sas = new dcomplex**[nsph];
  sas[0] = new dcomplex*[nsph*2];
  sas[0][0] = new dcomplex[nsph*2*2];
  sas[0][1] = sas[0][0]+2;
  for (int si = 1; si < nsph; si++) {
    sas[si] = sas[0]+2*si;
    sas[si][0] = sas[0][0]+4*si;
    sas[si][1] = sas[si][0]+2;
  }
  for (int si = 0; si < nsph; si++) {
    sas[si] = new dcomplex*[2];
    for (int sj=0; sj<2; sj++) {
      sas[si][sj] = new dcomplex[2]();
      MPI_Bcast(sas[si][sj], 2, MPI_C_DOUBLE_COMPLEX, 0, MPI_COMM_WORLD);
    }
  }
@@ -311,11 +326,8 @@ C1::~C1() {
  delete[] vint;
  delete[] vec_vints;
  delete[] vints;
  for (int si = nsph - 1; si > -1; si--) {
    delete[] sas[si][1];
    delete[] sas[si][0];
    delete[] sas[si];
  }
  delete[] sas[0][0];
  delete[] sas[0];
  delete[] sas;
  delete[] fsas;
  delete[] sscs;
+424 −95

File changed.

Preview size limit exceeded, changes collapsed.