Browse Source

Only set stream when using magma. Without using magma, starpu_cublas_init is enough

Samuel Thibault 10 years ago
parent
commit
2d00fb74e7

+ 3 - 0
examples/cholesky/cholesky_grain_tag.c

@@ -277,6 +277,8 @@ static void initialize_system(float **A, unsigned dim, unsigned pinned)
 	initialize_chol_model(&chol_model_22,"chol_model_22",cpu_chol_task_22_cost,NULL);
 	initialize_chol_model(&chol_model_22,"chol_model_22",cpu_chol_task_22_cost,NULL);
 #endif
 #endif
 
 
+	starpu_cublas_init();
+
 #ifndef STARPU_SIMGRID
 #ifndef STARPU_SIMGRID
 	if (pinned)
 	if (pinned)
 	{
 	{
@@ -321,6 +323,7 @@ static void shutdown_system(float **matA, unsigned pinned)
 	     free(*matA);
 	     free(*matA);
 	}
 	}
 
 
+	starpu_cublas_shutdown();
 	starpu_shutdown();
 	starpu_shutdown();
 }
 }
 
 

+ 3 - 0
examples/cholesky/cholesky_implicit.c

@@ -331,6 +331,8 @@ int main(int argc, char **argv)
 	initialize_chol_model(&chol_model_22,"chol_model_22",cpu_chol_task_22_cost,NULL);
 	initialize_chol_model(&chol_model_22,"chol_model_22",cpu_chol_task_22_cost,NULL);
 #endif
 #endif
 
 
+	starpu_cublas_init();
+
 	if(with_ctxs)
 	if(with_ctxs)
 	{
 	{
 		construct_contexts(execute_cholesky);
 		construct_contexts(execute_cholesky);
@@ -345,6 +347,7 @@ int main(int argc, char **argv)
 	else
 	else
 		execute_cholesky(size, nblocks);
 		execute_cholesky(size, nblocks);
 
 
+	starpu_cublas_shutdown();
 	starpu_shutdown();
 	starpu_shutdown();
 
 
 	return ret;
 	return ret;

+ 4 - 0
examples/cholesky/cholesky_kernels.c

@@ -71,7 +71,9 @@ static inline void chol_common_cpu_codelet_update_u22(void *descr[], int s, STAR
 	{
 	{
 		/* CUDA kernel */
 		/* CUDA kernel */
 #ifdef STARPU_USE_CUDA
 #ifdef STARPU_USE_CUDA
+#ifdef STARPU_HAVE_MAGMA
 		cublasSetKernelStream(starpu_cuda_get_local_stream());
 		cublasSetKernelStream(starpu_cuda_get_local_stream());
+#endif
 		cublasSgemm('n', 't', dy, dx, dz, 
 		cublasSgemm('n', 't', dy, dx, dz, 
 				-1.0f, left, ld21, right, ld12, 
 				-1.0f, left, ld21, right, ld12, 
 				 1.0f, center, ld22);
 				 1.0f, center, ld22);
@@ -118,7 +120,9 @@ static inline void chol_common_codelet_update_u21(void *descr[], int s, STARPU_A
 			break;
 			break;
 #ifdef STARPU_USE_CUDA
 #ifdef STARPU_USE_CUDA
 		case 1:
 		case 1:
+#ifdef STARPU_HAVE_MAGMA
 			cublasSetKernelStream(starpu_cuda_get_local_stream());
 			cublasSetKernelStream(starpu_cuda_get_local_stream());
+#endif
 			cublasStrsm('R', 'L', 'T', 'N', nx21, ny21, 1.0f, sub11, ld11, sub21, ld21);
 			cublasStrsm('R', 'L', 'T', 'N', nx21, ny21, 1.0f, sub11, ld11, sub21, ld21);
 			break;
 			break;
 #endif
 #endif

+ 3 - 0
examples/cholesky/cholesky_tag.c

@@ -244,6 +244,8 @@ static int initialize_system(float **A, unsigned dim, unsigned pinned)
 	initialize_chol_model(&chol_model_22,"chol_model_22",cpu_chol_task_22_cost,NULL);
 	initialize_chol_model(&chol_model_22,"chol_model_22",cpu_chol_task_22_cost,NULL);
 #endif
 #endif
 
 
+	starpu_cublas_init();
+
 #ifndef STARPU_SIMGRID
 #ifndef STARPU_SIMGRID
 	if (pinned)
 	if (pinned)
 	{
 	{
@@ -297,6 +299,7 @@ static void shutdown_system(float **matA, unsigned pinned)
 		free(*matA);
 		free(*matA);
 	}
 	}
 
 
+	starpu_cublas_shutdown();
 	starpu_shutdown();
 	starpu_shutdown();
 }
 }
 
 

+ 4 - 0
examples/cholesky/cholesky_tile_tag.c

@@ -242,6 +242,8 @@ int main(int argc, char **argv)
 	/* Disable sequential consistency */
 	/* Disable sequential consistency */
 	starpu_data_set_default_sequential_consistency_flag(0);
 	starpu_data_set_default_sequential_consistency_flag(0);
 
 
+	starpu_cublas_init();
+
 #ifndef STARPU_SIMGRID
 #ifndef STARPU_SIMGRID
 	for (y = 0; y < nblocks; y++)
 	for (y = 0; y < nblocks; y++)
 	for (x = 0; x < nblocks; x++)
 	for (x = 0; x < nblocks; x++)
@@ -301,6 +303,8 @@ int main(int argc, char **argv)
 		}
 		}
 	}
 	}
 
 
+	starpu_cublas_shutdown();
+
 	starpu_shutdown();
 	starpu_shutdown();
 	return ret;
 	return ret;
 }
 }