Skip to content
Snippets Groups Projects
Commit 4a263c1c authored by d74ksy's avatar d74ksy
Browse files

Some fixes and additions. Now synchronises to get better timings

parent fd08d3bd
Branches
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
/* Standard includes. */ /* Standard includes. */
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
...@@ -40,7 +41,7 @@ ...@@ -40,7 +41,7 @@
#include "quicksched.h" #include "quicksched.h"
#include "res.h" #include "res.h"
#define NO_TASK_TIMERS #define TASK_TIMERS
#ifdef WITH_CBLAS #ifdef WITH_CBLAS
/** /**
...@@ -610,7 +611,7 @@ task_tids = (int*)calloc(sizeof(int), m*n*K*K); ...@@ -610,7 +611,7 @@ task_tids = (int*)calloc(sizeof(int), m*n*K*K);
task_types = (int*)calloc(sizeof(int), m*n*K*K); task_types = (int*)calloc(sizeof(int), m*n*K*K);
#endif #endif
if(s.rank == 0){
/* Allocate and fill the original matrix. */ /* Allocate and fill the original matrix. */
if ((A = (double*)malloc(sizeof(double)* m* n* K* K)) == NULL || if ((A = (double*)malloc(sizeof(double)* m* n* K* K)) == NULL ||
(tau = (double*)malloc(sizeof(double)* m* n* K)) == NULL || (tau = (double*)malloc(sizeof(double)* m* n* K)) == NULL ||
...@@ -624,7 +625,7 @@ if(s.rank == 0){ ...@@ -624,7 +625,7 @@ if(s.rank == 0){
} }
memcpy(A, A_orig, sizeof(double) * m * n * K * K); memcpy(A, A_orig, sizeof(double) * m * n * K * K);
bzero(tau, sizeof(double) * m * n * K); bzero(tau, sizeof(double) * m * n * K);
if(s.rank == 0){
/* Initialize the scheduler. */ /* Initialize the scheduler. */
/* Allocate and init the task ID and resource ID matrix. */ /* Allocate and init the task ID and resource ID matrix. */
// tic = getticks(); // tic = getticks();
...@@ -778,8 +779,6 @@ qsched_run_MPI(&s, nr_threads, runner); ...@@ -778,8 +779,6 @@ qsched_run_MPI(&s, nr_threads, runner);
printf("Hello world from processor %s, rank = %i, count_ranks = %i\n", printf("Hello world from processor %s, rank = %i, count_ranks = %i\n",
processor_name, s.rank, s.count_ranks); processor_name, s.rank, s.count_ranks);
//TODO Clean up the resource data.
qsched_free(&s);
#ifdef TASK_TIMERS #ifdef TASK_TIMERS
FILE *file = NULL; FILE *file = NULL;
...@@ -795,7 +794,7 @@ FILE *file = NULL; ...@@ -795,7 +794,7 @@ FILE *file = NULL;
for(i = 0; i < m*n*K*K; i++) for(i = 0; i < m*n*K*K; i++)
{ {
if(task_types[i] > 0) if(task_types[i] > 0)
fprintf(file, "%i %i %lli %lli\n", task_types[i], task_tids[i],task_start[i], task_finish[i] ); fprintf(file, "%i %i %lli %lli\n", task_types[i], s.rank*nr_threads+task_tids[i],task_start[i], task_finish[i] );
} }
...@@ -805,6 +804,34 @@ FILE *file = NULL; ...@@ -805,6 +804,34 @@ FILE *file = NULL;
free(task_start); free(task_start);
free(task_finish); free(task_finish);
#endif #endif
//TODO Copy all the resources back into A, synchronize them across the nodes and check correctness.
if(s.count_ranks > 1 && s.rank == 0)
{
errno = 0;
FILE *file2 = fopen("resource_allocation.out", "w");
if(file2 == NULL)
error("Failed to open file2 %d ", errno);
for(i = 0; i < n; i++)
{
for(j = 0; j < m; j++)
{
/*printf("j*m+i= %i\n", j*m+i);
printf("rid[j*m+i] = %lli\n", rid[j*m+i]);
printf("s.res = %p\n", &s.res[rid[j*m+i]]);
printf("s.res[rid[j*m+i]].node = %i\n", s.res[rid[j*m+i]].node);*/
fprintf(file2, "%i, ", s.res[rid[j*m+i]].node);
}
fprintf(file2, "\n");
}
fclose(file2);
}
//TODO Clean up the resource data.
qsched_free(&s);
free(A);
free(A_orig);
free(tau);
// Finalize the MPI environment. // Finalize the MPI environment.
MPI_Finalize(); MPI_Finalize();
} }
......
...@@ -3420,6 +3420,7 @@ void qsched_run_MPI ( struct qsched *s, int nr_threads, qsched_funtype fun ) { ...@@ -3420,6 +3420,7 @@ void qsched_run_MPI ( struct qsched *s, int nr_threads, qsched_funtype fun ) {
printf("Rank[%i]: qsched_prepare_mpi took %lli (= %e) ticks\n", s->rank, printf("Rank[%i]: qsched_prepare_mpi took %lli (= %e) ticks\n", s->rank,
toc - tic, (float)(toc - tic)); toc - tic, (float)(toc - tic));
MPI_Barrier(s->comm);
message("Beginning execution of quicksched"); message("Beginning execution of quicksched");
tic = getticks(); tic = getticks();
#if defined( HAVE_OPENMP ) #if defined( HAVE_OPENMP )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment