From 7f6ad68f53f5bc7f3f9120d981d85e2bfee64d7f Mon Sep 17 00:00:00 2001 From: Florian Stecker Date: Mon, 11 Apr 2022 11:22:13 -0500 Subject: [PATCH] Some random changes to parallelism I don't really remember what these changes were about, but it seems to run; have to look at parallelism stuff again in the future to get decent performance --- billiard_picture.sh | 14 ++++++++------ mat.h | 2 +- parallel.c | 27 ++++++++++++++++++++++++--- run_local | 2 +- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/billiard_picture.sh b/billiard_picture.sh index a415508..d2c75af 100755 --- a/billiard_picture.sh +++ b/billiard_picture.sh @@ -3,21 +3,23 @@ trap 'exit 130' INT wordlength=30 -sdenom=100 +sdenom=1 sstart=1 -send=100 +send=1 qdenom=100 qstart=1 -qend=100 # 1/sqrt(2) = 0.7071... +qend=200 # 1/sqrt(2) = 0.7071... -#words="$(./billiard_words $wordlength | awk '{print $1}')" +words="$(./billiard_words $wordlength | awk '{print $1}')" #words="cbabcabacabcacbcab cabacabcacbcabcbab cabcacbcabcbabcaba" -words="abcb acbc baca" +#words="abcabc abcb cbabcacbcacbab" +#words="abcabc abcbcabcbc" +#words="abcabc bcbab bcbabcac" for s in $(seq $sstart $send); do for q in $(seq $qstart $qend); do i=0 - echo -n "$s/$sdenom $q/$qdenom " + echo -n "$s/$sdenom $q/$qdenom " # MAXIMUM=only ./special_element $s/$sdenom $q/$qdenom $words # MAXIMUM=no ./special_element $s/$sdenom $q/$qdenom abcb MAXIMUM=no ./special_element $s/$sdenom $q/$qdenom $words | while read line; do diff --git a/mat.h b/mat.h index 06b067b..5c548e3 100644 --- a/mat.h +++ b/mat.h @@ -12,7 +12,7 @@ needed features: x multiply matrices - inverse - - pseudoinverse + x pseudoinverse x set - eigenvalues */ diff --git a/parallel.c b/parallel.c index 95e2bca..aa90ae0 100644 --- a/parallel.c +++ b/parallel.c @@ -10,7 +10,8 @@ #include #include -#define DEBUG INFO +//#define DEBUG INFO +#define DEBUG(msg, ...) #define INFO(msg, ...) fprintf(stderr, "[%003d%10.3f] " msg, mpi_rank(0), runtime(), ##__VA_ARGS__) //#define DEBUG(msg, ...) fprintf(stderr, "[ %10.3f] " msg, runtime(), ##__VA_ARGS__) //#define DEBUG_MPI(msg, node, ...) fprintf(stderr, "[%003d%10.3f] " msg, node, runtime(), ##__VA_ARGS__) @@ -128,8 +129,12 @@ int parallel_job(parallel_context *ctx, const void *global_data, void *node_data int message_present; if(block) { + jobtime = -MPI_Wtime(); MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &status); + jobtime += MPI_Wtime(); + + INFO("TIMING: Probe() took %f seconds\n", jobtime); message_present = 1; } else { MPI_Iprobe(0, MPI_ANY_TAG, MPI_COMM_WORLD, @@ -157,12 +162,16 @@ int parallel_job(parallel_context *ctx, const void *global_data, void *node_data jobtime += MPI_Wtime(); - DEBUG("Finished job %d in %f seconds\n", *job_nr, jobtime); + INFO("TIMING: job %d took %f seconds\n", *job_nr, jobtime); *output_job_nr = *job_nr; + jobtime = -MPI_Wtime(); MPI_Send(output_and_job_nr, 1, ctx->result_datatype, 0, PARALLEL_RESULT, MPI_COMM_WORLD); + jobtime += MPI_Wtime(); + + INFO("TIMING: Send() took %f seconds\n", jobtime); } } else { result = 2; @@ -359,13 +368,25 @@ int parallel_run(parallel_context *ctx, const void *global_data, const void *inp INFO("job %d completed by node %d, shut down, %d workers remaining\n", id, node, active_worker_nodes); } } else { - INFO("job %d completed by node %d, continues with %d\n", id, node, current); *((int*)input_message_buffer) = current; memcpy(input_message_buffer + sizeof(int), input_array + current*ctx->input_size, ctx->input_size); MPI_Send(input_message_buffer, 1, ctx->order_datatype, node, PARALLEL_ORDER, MPI_COMM_WORLD); active_jobs[node]++; current++; + + if(active_jobs[node] < 3) { + *((int*)input_message_buffer) = current; + memcpy(input_message_buffer + sizeof(int), input_array + current*ctx->input_size, ctx->input_size); + MPI_Send(input_message_buffer, 1, ctx->order_datatype, + node, PARALLEL_ORDER, MPI_COMM_WORLD); + active_jobs[node]++; + current++; + + INFO("job %d completed by node %d, continues with %d and %d\n", id, node, current-1, current-2); + } else { + INFO("job %d completed by node %d, continues with %d\n", id, node, current-1); + } } } } diff --git a/run_local b/run_local index 76dcf8c..0c23ecc 100755 --- a/run_local +++ b/run_local @@ -6,4 +6,4 @@ nmax=700000 # up to reflection group word length 22 ( 444 group) #time mpirun --mca opal_warn_on_missing_libcuda 0 -x LD_LIBRARY_PATH=/home/stecker/svmpi/libs ./singular_values $nmax ejp_trg_restart test.out -time mpirun --mca opal_warn_on_missing_libcuda 0 --mca mpi_yield_when_idle 1 -np 4 ./singular_values 700000 4 4 4 1 10 100 1 10 100 +time mpirun --mca opal_warn_on_missing_libcuda 0 --mca mpi_yield_when_idle 1 -np 4 ./singular_values 700000 4 4 4 1 1 100 1 100 100 $1