浏览代码

julia/examples: small fixes

Nathalie Furmento 5 年之前
父节点
当前提交
a71254bf7d
共有 3 个文件被更改,包括 11 次插入9 次删除
  1. 2 2
      julia/examples/mult/cpu_mult.c
  2. 3 6
      julia/examples/mult/mult.c
  3. 6 1
      julia/examples/vector_scal/vector_scal.jl

+ 2 - 2
julia/examples/mult/cpu_mult.c

@@ -25,12 +25,12 @@
  * in the case of CPU, GPU frame buffer in the case of GPU etc.). Since we have
  * registered data with the "matrix" data interface, we use the matrix macros.
  */
-void cpu_mult(void *descr[], void *arg)
+void cpu_mult(void *descr[], void *cl_arg)
 {
 	int stride;
 	float *subA, *subB, *subC;
 
-	stride = *((int *)arg);
+	stride = *((int *)cl_arg);
 
 	/* .blas.ptr gives a pointer to the first element of the local copy */
 	subA = (float *)STARPU_MATRIX_GET_PTR(descr[0]);

+ 3 - 6
julia/examples/mult/mult.c

@@ -116,7 +116,8 @@ void multiply_with_starpu(float *A, float *B, float *C,  unsigned xdim,  unsigne
 			task->cl_arg = &stride;
 			task->cl_arg_size = sizeof(stride);
 
-			if (starpu_task_submit(task)!=0) fprintf(stderr,"submit task error\n");
+			int ret = starpu_task_submit(task);
+			STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 		}
 	}
 
@@ -192,11 +193,7 @@ void display_times(unsigned start_dim, unsigned step_dim, unsigned stop_dim, uns
 	}
 }
 
-#ifdef STARPU_QUICK_CHECK
-#define STRIDE_DEFAULT 4
-#else
-#define STRIDE_DEFAULT 72
-#endif
+#define STRIDE_DEFAULT 8
 
 int main(int argc, char * argv[])
 {

+ 6 - 1
julia/examples/vector_scal/vector_scal.jl

@@ -73,8 +73,13 @@ function compute_times(io,start_dim, step_dim, stop_dim)
     end
 end
 
+if size(ARGS, 1) < 1
+    filename="x.dat"
+else
+    filename=ARGS[1]
+end
 
-io=open(ARGS[1],"w")
+io=open(filename,"w")
 compute_times(io,1024,1024,4096)
 close(io)