From d673a968c828eb5a151bd6ed9299c54373841a89 Mon Sep 17 00:00:00 2001 From: Patricia Larsen Date: Mon, 31 Jul 2023 13:06:42 -0500 Subject: [PATCH] applying updates to grav only --- density_maps/main.cxx | 48 +++++++++++++++++++++++++++++++------- density_maps/pix_funcs.cxx | 13 +++++++++-- density_maps/pix_funcs.h | 2 +- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/density_maps/main.cxx b/density_maps/main.cxx index 6eab618..40bb1b3 100644 --- a/density_maps/main.cxx +++ b/density_maps/main.cxx @@ -49,12 +49,12 @@ int main(int argc, char *argv[]) { MPI_Comm_rank(MPI_COMM_WORLD, &commRank); MPI_Comm_size(MPI_COMM_WORLD, &commRanks); - double t1, t2, t3; + double t1, t2, t3, t4, t5; t1 = MPI_Wtime(); - if(argc != 6) { + if(argc != 10) { if (commRank==0){ - fprintf(stderr,"USAGE: %s \n", argv[0]); + fprintf(stderr,"USAGE: %s \n", argv[0]); } exit(-1); } @@ -68,6 +68,12 @@ int main(int argc, char *argv[]) { string stepnumber = argv[5]; string outfile = argv[2]; + float hval = atof(argv[6]); + float samplerate = atof(argv[7]); + int start_step = atoi(argv[8]); + int nsteps = atoi(argv[9]); + + double rank1 = log2(nside); double rank2 = log2(nside_low); int rank_diff = (int) (rank1-rank2); @@ -138,7 +144,21 @@ int main(int argc, char *argv[]) { printf( "Elapsed time for initialization is %f\n", t3 - t1 ); } - read_and_redistribute(filename, commRanks, &P, map_lores, map_hires, rank_diff); + for (int jj=0;jj &rho, vector &phi, vector &vel, PLParticles* P, T_Healpix_Base map_hires, vector pixnum_start, vector pixnum_end, vector start_idx, unordered_map ring_to_idx){ + + + +int assign_dm_cic(vector &rho, vector &phi, vector &vel, PLParticles* P, T_Healpix_Base map_hires, vector pixnum_start, vector pixnum_end, vector start_idx, unordered_map ring_to_idx, float hval, float samplerate){ int64_t npix = map_hires.Npix(); float pixsize = (4.*3.141529/npix); + #ifdef _OPENMP + #pragma omp parallel for + #endif for (int64_t ii=0; ii<(*P).nparticles; ++ii){ float xd = (float) (*P).float_data[0]->at(ii); float yd = (float) (*P).float_data[1]->at(ii); @@ -249,10 +255,13 @@ int assign_dm_cic(vector &rho, vector &phi, vector &vel, PL int64_t pix_num = neighbs[j]; int64_t new_idx = -99; if (ring_to_idx.count(pix_num)){ - new_idx = ring_to_idx[pix_num]; + new_idx = ring_to_idx[pix_num]; + #pragma omp critical + { rho[new_idx] += 1./pixsize*weights[j]; phi[new_idx] += phid*weights[j]; vel[new_idx] += vel_los*weights[j]; + } } } } diff --git a/density_maps/pix_funcs.h b/density_maps/pix_funcs.h index f3275c2..6c81fed 100644 --- a/density_maps/pix_funcs.h +++ b/density_maps/pix_funcs.h @@ -9,7 +9,7 @@ void get_pix_list_rank(int octant, int rank, int numranks, int64_t npix_lores, s int compute_ranks_count( PLParticles* P, T_Healpix_Base map_lores, T_Healpix_Base map_hires, int numranks, vector &send_count, int rank_diff); void compute_ranks_index( PLParticles* P, T_Healpix_Base map_lores, T_Healpix_Base map_hires, int numranks, vector send_off, vector &id_particles, int rank_diff); int assign_dm_ngp(vector &rho, vector &phi, vector &vel, PLParticles* P, T_Healpix_Base map_hires, vector pixnum_start, vector pixnum_end, vector start_idx, unordered_map ring_to_idx); -int assign_dm_cic(vector &rho, vector &phi, vector &vel, PLParticles* P, T_Healpix_Base map_hires, vector pixnum_start, vector pixnum_end, vector start_idx, unordered_map ring_to_idx); +int assign_dm_cic(vector &rho, vector &phi, vector &vel, PLParticles* P, T_Healpix_Base map_hires, vector pixnum_start, vector pixnum_end, vector start_idx, unordered_map ring_to_idx, float hval, float samplerate); int assign_sz_ngp(vector &rho, vector &phi, vector &vel,vector &ksz, vector &tsz, PLParticles* P, T_Healpix_Base map_hires, vector pixnum_start, vector pixnum_end, vector start_idx, unordered_map ring_to_idx);