Skip to content
Snippets Groups Projects
Commit 911f717d authored by kchndrs2's avatar kchndrs2
Browse files

Fix timing bug and splitter rng bug

Change-Id: I9bc07d23798ea01832b10e208b6ba945ef8ff3d8
parent 3cd53b3f
No related branches found
No related tags found
No related merge requests found
......@@ -61,10 +61,12 @@ struct timezone { int tz_minuteswest;
void generateSetOfNumbers(int arr[], int n)
{
int p[10] = {0,1,2,3,4,5,6,7,8,9};
int p[n];
for(int i=0;i<n;i++)
p[i] = i;
//shuffle p
for (int i=9; i>0; --i)
for (int i=n; i>0; --i)
{
//get swap index
int j = rand()%i;
......@@ -137,7 +139,7 @@ int main(int argc, char** argv) {
MPI_Get_processor_name(processor_name, &name_len);
int nProcs = world_size;
int s = 2;
int s = 64;
int dataCount = 1<<12;
int data_per_proc = dataCount/nProcs;
......@@ -272,9 +274,11 @@ int main(int argc, char** argv) {
int final_data[dataCount];
int global_count = 0;
int total_bucket_size = 0;
for(int i=0;i<nProcs;i++){
int num_b;
MPI_Recv(&num_b, 1, MPI_INT, i, 0, MPI_COMM_WORLD,MPI_STATUS_IGNORE);
total_bucket_size += num_b;
int data_new[num_b];
MPI_Recv(data_new, num_b, MPI_INT, i, 0, MPI_COMM_WORLD,MPI_STATUS_IGNORE);
for(int j=0;j<num_b;j++){
......@@ -285,6 +289,8 @@ int main(int argc, char** argv) {
}
}
printf("\nProc-%d's bucket size=%d\n", world_rank, total_bucket_size);
for(int j=0;j<nProcs;j++){
MPI_Wait(&request1[j], &status1[j]);
MPI_Wait(&request2[j], &status2[j]);
......@@ -305,7 +311,10 @@ int main(int argc, char** argv) {
" out of %d processors\n",
processor_name, world_rank, world_size);
#endif
int dummy = nProcs;
MPI_Bcast(&dummy, 1, MPI_INT, 0, MPI_COMM_WORLD); //Barrier for timing
MPI_Barrier(MPI_COMM_WORLD);
if(world_rank==0)
printf("\nTime = %lf\n", mysecond_()-start_time);
// Finalize the MPI environment.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment