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

Merge branch 'clu_subs_offload' into 'master'

Add parser for INCLUSION

See merge request giacomo.mulas/np_tmcode!103
parents e39cb1e4 6317b748
Loading
Loading
Loading
Loading
+1 −43
Original line number Diff line number Diff line
@@ -287,51 +287,9 @@ void cluster(const string& config_file, const string& data_file, const string& o
	p_output->vec_vk[0] = cid->vk;
      }

      // do the first iteration on jxi488 separately, since it seems to be different from the others
      // not anymore, now this iteration is at the same level as others
      int jxi488;
      int initialmaxrefiters = cid->maxrefiters;
      //chrono::time_point<chrono::high_resolution_clock> start_iter_1 = chrono::high_resolution_clock::now();
// #ifdef USE_NVTX
//       nvtxRangePush("First iteration");
// #endif
      // 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);
// 	} // OMP single
//       } // OMP parallel
// #ifdef USE_NVTX
//       nvtxRangePop();
// #endif
      //chrono::time_point<chrono::high_resolution_clock> end_iter_1 = chrono::high_resolution_clock::now();
      //elapsed = start_iter_1 - t_start;
      // string message = "INFO: Calculation setup took " + to_string(elapsed.count()) + "s.\n";
      // logger->log(message);
      // time_logger->log(message);
      // elapsed = end_iter_1 - start_iter_1;
      // message = "INFO: First iteration took " + to_string(elapsed.count()) + "s.\n";
      // logger->log(message);
      // time_logger->log(message);
      /* for the next iterations, just always do maxiter iterations, assuming the accuracy is good enough */
      // cid->refinemode = 0;
      /* add an extra iteration for margin, if this does not exceed initialmaxrefiters */
      // if (cid->maxrefiters < initialmaxrefiters) cid->maxrefiters++;
      // if (jer != 0) {
      // 	// First loop failed. Halt the calculation.
      // 	fclose(timing_file);
      // 	delete time_logger;
      // 	delete p_output;
      // 	delete p_scattering_angles;
      // 	delete cid;
      // 	delete logger;
      // 	delete sconf;
      // 	delete gconf;
      // 	return;
      // }

      //==================================================
      // do the first outputs here, so that I open here the new files, afterwards I only append
@@ -683,9 +641,9 @@ void cluster(const string& config_file, const string& data_file, const string& o
    logger->log("INFO: Process " + to_string(mpidata->rank) + " finalizes MAGMA.\n");
    magma_finalize();
#endif
    delete logger;
#ifdef MPI_VERSION
  }
  delete logger;
#endif
}

+2 −1
Original line number Diff line number Diff line
@@ -79,8 +79,9 @@ void apcra(
 * \param jf: `int`
 * \param k: `int`
 * \param nj: `int`
 * \param istep: `np_int` Size of rows in the matrix.
 */
dcomplex cdtp(dcomplex z, dcomplex **am, int i, int jf, int k, int nj);
dcomplex cdtp(dcomplex z, dcomplex *vec_am, int i, int jf, int k, int nj, np_int istep);

/*! \brief C++ porting of CGEV. QUESTION: description?
 *
+1 −44
Original line number Diff line number Diff line
@@ -277,51 +277,9 @@ void inclusion(const string& config_file, const string& data_file, const string&
	p_output->vec_vk[0] = cid->vk;
      }
      
      // do the first iteration on jxi488 separately, since it seems to be different from the others
      int jxi488;
      int initialmaxrefiters = cid->maxrefiters;
      
//       chrono::time_point<chrono::high_resolution_clock> start_iter_1 = chrono::high_resolution_clock::now();
// #ifdef USE_NVTX
//       nvtxRangePush("First iteration");
// #endif
      // 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 = inclusion_jxi488_cycle(jxi488, sconf, gconf, p_scattering_angles, cid, p_output, output_path, vtppoanp);
// 	}
//       }
// #ifdef USE_NVTX
//       nvtxRangePop();
// #endif
//       chrono::time_point<chrono::high_resolution_clock> end_iter_1 = chrono::high_resolution_clock::now();
//       elapsed = start_iter_1 - t_start;
//       string message = "INFO: Calculation setup took " + to_string(elapsed.count()) + "s.\n";
//       logger->log(message);
//       time_logger->log(message);
//       elapsed = end_iter_1 - start_iter_1;
//       message = "INFO: First iteration took " + to_string(elapsed.count()) + "s.\n";
//       logger->log(message);
//       time_logger->log(message);
      /* for the next iterations, just always do maxiter iterations, assuming the accuracy is good enough */
      // cid->refinemode = 0;
      // /* add an extra iteration for margin, if this does not exceed initialmaxrefiters */
      // // if (cid->maxrefiters < initialmaxrefiters) cid->maxrefiters++;
      // if (jer != 0) {
      // 	// First loop failed. Halt the calculation.
      // 	fclose(timing_file);
      // 	delete time_logger;
      // 	delete p_output;
      // 	delete p_scattering_angles;
      // 	delete cid;
      // 	delete logger;
      // 	delete sconf;
      // 	delete gconf;
      // 	return;
      // }

      //==================================================
      // do the first outputs here, so that I open here the new files, afterwards I only append
@@ -536,7 +494,6 @@ void inclusion(const string& config_file, const string& data_file, const string&
    time_logger->log(message);
    fclose(timing_file);
    delete time_logger;
    delete logger;
  } // end instructions block of MPI process 0
  
    //===============================
@@ -666,10 +623,10 @@ void inclusion(const string& config_file, const string& data_file, const string&
    logger->log("INFO: Process " + to_string(mpidata->rank) + " finalizes MAGMA.\n");
    magma_finalize();
#endif
    delete logger;
#ifdef MPI_VERSION
  }
#endif
  delete logger;
}

int inclusion_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConfiguration *gconf, ScatteringAngles *sa, InclusionIterationData *cid, InclusionOutputInfo *output, const string& output_path, VirtualBinaryFile *vtppoanp) {
+8 −18
Original line number Diff line number Diff line
@@ -347,8 +347,8 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil
	conf->_refine_flag = refine_flag;
      }
    }
    if (str_target.size() > 14) {
      if (str_target.substr(0, 14).compare("USE_DYN_ORDER=") == 0) {
    if (str_target.size() > 15) {
      if (str_target.substr(0, 15).compare("USE_DYN_ORDERS=") == 0) {
	regex_search(str_target, m, re);
	short dyn_order_flag = (short)stoi(m.str());
	conf->_dyn_order_flag = dyn_order_flag;
@@ -362,21 +362,11 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil
}

ScattererConfiguration::ScattererConfiguration(
					       int nsph,
					       int configs, 
					       double *scale_vector,
					       int nxi,
					       const std::string& variable_name,
					       int *iog_vector,
					       double *ros_vector,
					       int *nshl_vector,
					       double **rcf_vector,
					       int dielectric_func_type,
					       dcomplex ***dc_matrix,
					       bool is_external,
					       double ex,
					       double w,
					       double x
  int nsph, int configs, double *scale_vector, int nxi,
  const std::string& variable_name, int *iog_vector,
  double *ros_vector, int *nshl_vector, double **rcf_vector,
  int dielectric_func_type, dcomplex ***dc_matrix, bool is_external,
  double ex, double w, double x
) {
  _number_of_spheres = nsph;
  _configurations = configs;
+1 −1
Original line number Diff line number Diff line
@@ -86,6 +86,6 @@ void invert_matrix(dcomplex **mat, np_int size, int &ier, int &maxrefiters, doub
  zinvert(mat, size, ier);
#endif
#else
  lucin(mat, max_size, size, ier);
  lucin(mat, size, size, ier);
#endif
}
Loading