Преглед на файлове

port r12993 from 1.1: Fix crash with a lot of MPI nodes

Samuel Thibault преди 11 години
родител
ревизия
fe9ca6b56f
променени са 4 файла, в които са добавени 16 реда и са изтрити 2 реда
  1. 2 1
      examples/axpy/axpy.c
  2. 1 1
      examples/incrementer/incrementer.c
  3. 3 0
      examples/incrementer/incrementer_kernels.cu
  4. 10 0
      src/debug/traces/starpu_fxt.c

+ 2 - 1
examples/axpy/axpy.c

@@ -36,7 +36,7 @@
 
 #define N	(16*1024*1024)
 
-#define NBLOCKS	8
+#define NBLOCKS	(8)
 
 #define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
@@ -70,6 +70,7 @@ void axpy_gpu(void *descr[], STARPU_ATTRIBUTE_UNUSED void *arg)
 	TYPE *block_x = (TYPE *)STARPU_VECTOR_GET_PTR(descr[0]);
 	TYPE *block_y = (TYPE *)STARPU_VECTOR_GET_PTR(descr[1]);
 
+	cublasSetKernelStream(starpu_cuda_get_local_stream());
 	CUBLASAXPY((int)n, alpha, block_x, 1, block_y, 1);
 }
 #endif

+ 1 - 1
examples/incrementer/incrementer.c

@@ -18,7 +18,7 @@
 #include <starpu.h>
 #include <sys/time.h>
 
-static unsigned niter = 50000;
+static unsigned niter = 50;
 #define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #ifdef STARPU_USE_CUDA

+ 3 - 0
examples/incrementer/incrementer_kernels.cu

@@ -19,8 +19,11 @@
 
 static __global__ void cuda_incrementer(float * tab)
 {
+	int i;
 	tab[0] = tab[0] + 1.0f;
 	tab[2] = tab[2] + 1.0f;
+	for (i = 0; i < 1000000; i++)
+		__syncthreads();
 
 	return;
 }

+ 10 - 0
src/debug/traces/starpu_fxt.c

@@ -46,21 +46,29 @@ static unsigned other_index = 0;
 
 static void set_next_other_worker_color(int workerid)
 {
+	if (workerid >= STARPU_NMAXWORKERS)
+		return;
 	worker_colors[workerid] = other_worker_colors[other_index++];
 }
 
 static void set_next_cpu_worker_color(int workerid)
 {
+	if (workerid >= STARPU_NMAXWORKERS)
+		return;
 	worker_colors[workerid] = cpus_worker_colors[cpus_index++];
 }
 
 static void set_next_cuda_worker_color(int workerid)
 {
+	if (workerid >= STARPU_NMAXWORKERS)
+		return;
 	worker_colors[workerid] = cuda_worker_colors[cuda_index++];
 }
 
 static void set_next_opencl_worker_color(int workerid)
 {
+	if (workerid >= STARPU_NMAXWORKERS)
+		return;
 	worker_colors[workerid] = opencl_worker_colors[opencl_index++];
 }
 
@@ -76,6 +84,8 @@ static void set_next_scc_worker_color(int workerid)
 
 static const char *get_worker_color(int workerid)
 {
+	if (workerid >= STARPU_NMAXWORKERS)
+		workerid = STARPU_NMAXWORKERS - 1;
 	return worker_colors[workerid];
 }