|
@@ -13,7 +13,7 @@ typedef struct {
|
|
|
double avg_timing;
|
|
|
} retvals;
|
|
|
|
|
|
-#define NSAMPLES 1
|
|
|
+#define NSAMPLES 5
|
|
|
|
|
|
pthread_barrier_t barrier;
|
|
|
|
|
@@ -37,28 +37,40 @@ void* func_cholesky(void *val){
|
|
|
return (void*)rv;
|
|
|
}
|
|
|
|
|
|
-void cholesky_vs_cholesky(params *p1, params *p2, params *p3){
|
|
|
+void cholesky_vs_cholesky(params *p1, params *p2, params *p3, int ncpus1, int ncpus2){
|
|
|
/* 2 cholesky in different ctxs */
|
|
|
starpu_init(NULL);
|
|
|
starpu_helper_cublas_init();
|
|
|
|
|
|
- int procs[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
|
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
|
|
|
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
|
|
- 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
|
|
- 48, 49, 50, 51, 52, 53, 54,
|
|
|
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
|
|
|
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
|
|
|
- 79, 80, 81};
|
|
|
- p1->ctx = starpu_create_sched_ctx("heft", procs, 82, "cholesky1");
|
|
|
+ int procs[ncpus1];
|
|
|
+ int i;
|
|
|
+ for(i = 0; i < ncpus1; i++)
|
|
|
+ procs[i] = i;
|
|
|
+
|
|
|
+ p1->ctx = starpu_create_sched_ctx("heft", procs, ncpus1, "cholesky1");
|
|
|
+
|
|
|
+ int procs2[ncpus2];
|
|
|
+
|
|
|
+ for(i = 0; i < ncpus2; i++)
|
|
|
+ procs2[i] = ncpus1+i;
|
|
|
|
|
|
- int procs2[] = { 82, 83, 84, 85, 86, 87, 88, 89, 90,
|
|
|
- 91, 92, 93, 94, 95};
|
|
|
- p2->ctx = starpu_create_sched_ctx("heft", procs2, 14, "cholesky2");
|
|
|
+ p2->ctx = starpu_create_sched_ctx("heft", procs2, ncpus2, "cholesky2");
|
|
|
+
|
|
|
+/* int procs[] = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10}; */
|
|
|
+/* p1->ctx = starpu_create_sched_ctx("heft", procs, 10, "cholesky1"); */
|
|
|
+
|
|
|
+/* int procs2[] = {1, 11}; */
|
|
|
+/* p2->ctx = starpu_create_sched_ctx("heft", procs2, 2, "cholesky2"); */
|
|
|
|
|
|
pthread_t tid[2];
|
|
|
pthread_barrier_init(&barrier, NULL, 2);
|
|
|
|
|
|
+ struct timeval start;
|
|
|
+ struct timeval end;
|
|
|
+
|
|
|
+ gettimeofday(&start, NULL);
|
|
|
+
|
|
|
+
|
|
|
pthread_create(&tid[0], NULL, (void*)func_cholesky, (void*)p1);
|
|
|
pthread_create(&tid[1], NULL, (void*)func_cholesky, (void*)p2);
|
|
|
|
|
@@ -68,8 +80,17 @@ void cholesky_vs_cholesky(params *p1, params *p2, params *p3){
|
|
|
pthread_join(tid[0], &gflops_cholesky1);
|
|
|
pthread_join(tid[1], &gflops_cholesky2);
|
|
|
|
|
|
+ gettimeofday(&end, NULL);
|
|
|
+
|
|
|
starpu_helper_cublas_shutdown();
|
|
|
starpu_shutdown();
|
|
|
+
|
|
|
+ double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
|
|
|
+ timing /= 1000000;
|
|
|
+ timing /= 60;
|
|
|
+
|
|
|
+ printf("%2.2f %2.2f ", ((retvals*)gflops_cholesky1)->flops, ((retvals*)gflops_cholesky2)->flops);
|
|
|
+ printf("%2.2f %2.2f %2.2f\n", ((retvals*)gflops_cholesky1)->avg_timing, ((retvals*)gflops_cholesky2)->avg_timing, timing);
|
|
|
|
|
|
/* /\* 1 cholesky all alone on the whole machine *\/ */
|
|
|
/* starpu_init(NULL); */
|
|
@@ -113,6 +134,20 @@ void cholesky_vs_cholesky(params *p1, params *p2, params *p3){
|
|
|
int main(int argc, char **argv)
|
|
|
{
|
|
|
// printf("argc = %d\n", argc);
|
|
|
+ int ncpus1, ncpus2;
|
|
|
+ int i;
|
|
|
+ for (i = 9; i < argc; i++) {
|
|
|
+ if (strcmp(argv[i], "-ncpus1") == 0) {
|
|
|
+ char *argptr;
|
|
|
+ ncpus1 = strtol(argv[++i], &argptr, 10);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strcmp(argv[i], "-ncpus2") == 0) {
|
|
|
+ char *argptr;
|
|
|
+ ncpus2 = strtol(argv[++i], &argptr, 10);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // printf("%d %d\n", ncpus1, ncpus2);
|
|
|
params p1;
|
|
|
p1.start = 1;
|
|
|
p1.argc = 5;
|
|
@@ -120,14 +155,14 @@ int main(int argc, char **argv)
|
|
|
|
|
|
params p2;
|
|
|
p2.start = 5;
|
|
|
- p2.argc = argc;
|
|
|
+ p2.argc = 9;
|
|
|
p2.argv = argv;
|
|
|
|
|
|
params p3;
|
|
|
p3.argc = argc;
|
|
|
p3.argv = argv;
|
|
|
p3.ctx = 0;
|
|
|
- cholesky_vs_cholesky(&p1, &p2,&p3);
|
|
|
+ cholesky_vs_cholesky(&p1, &p2,&p3, ncpus1, ncpus2);
|
|
|
|
|
|
return 0;
|
|
|
}
|