Browse Source

doc/chapters: inversing size and array parameter in vector_scal example following r9395

Nathalie Furmento 12 years ago
parent
commit
9734a485ff

+ 9 - 9
doc/chapters/basic-examples.texi

@@ -442,8 +442,8 @@ vector_scal_opencl (unsigned size, float vector[size], float factor)
   if (err != CL_SUCCESS)
     STARPU_OPENCL_REPORT_ERROR (err);
 
-  err = clSetKernelArg (kernel, 0, sizeof (val), &val);
-  err |= clSetKernelArg (kernel, 1, sizeof (size), &size);
+  err = clSetKernelArg (kernel, 0, sizeof (size), &size);
+  err |= clSetKernelArg (kernel, 1, sizeof (val), &val);
   err |= clSetKernelArg (kernel, 2, sizeof (factor), &factor);
   if (err)
     STARPU_OPENCL_REPORT_ERROR (err);
@@ -512,7 +512,7 @@ the CUDA Kernel}).
 #include <stdlib.h>
 
 static __global__ void
-vector_mult_cuda (float *val, unsigned n, float factor)
+vector_mult_cuda (unsigned n, float *val, float factor)
 @{
   unsigned i = blockIdx.x * blockDim.x + threadIdx.x;
 
@@ -528,7 +528,7 @@ vector_scal_cuda (size_t size, float vector[], float factor)
   unsigned nblocks = (size + threads_per_block - 1) / threads_per_block;
 
   vector_mult_cuda <<< nblocks, threads_per_block, 0,
-    starpu_cuda_get_local_stream () >>> (vector, size, factor);
+    starpu_cuda_get_local_stream () >>> (size, vector, factor);
 
   cudaStreamSynchronize (starpu_cuda_get_local_stream ());
 @}
@@ -697,7 +697,7 @@ call.
 @smallexample
 #include <starpu.h>
 
-static __global__ void vector_mult_cuda(float *val, unsigned n,
+static __global__ void vector_mult_cuda(unsigned n, float *val,
                                         float factor)
 @{
     unsigned i =  blockIdx.x*blockDim.x + threadIdx.x;
@@ -717,7 +717,7 @@ extern "C" void scal_cuda_func(void *buffers[], void *_args)
     unsigned nblocks = (n + threads_per_block-1) / threads_per_block;
 
 @i{    vector_mult_cuda<<<nblocks,threads_per_block, 0, starpu_cuda_get_local_stream()>>>}
-@i{                    (val, n, *factor);}
+@i{                    (n, val, *factor);}
 
 @i{    cudaStreamSynchronize(starpu_cuda_get_local_stream());}
 @}
@@ -732,7 +732,7 @@ tools to compile a OpenCL kernel stored in a file.
 
 @cartouche
 @smallexample
-__kernel void vector_mult_opencl(__global float* val, int nx, float factor)
+__kernel void vector_mult_opencl(int nx, __global float* val, float factor)
 @{
         const int i = get_global_id(0);
         if (i < nx) @{
@@ -773,8 +773,8 @@ void scal_opencl_func(void *buffers[], void *_args)
 @i{                    "vector_mult_opencl", devid);   /* @b{Name of the codelet defined above} */}
 @i{    if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);}
 
-@i{    err = clSetKernelArg(kernel, 0, sizeof(val), &val);}
-@i{    err |= clSetKernelArg(kernel, 1, sizeof(n), &n);}
+@i{    err = clSetKernelArg(kernel, 0, sizeof(n), &n);}
+@i{    err |= clSetKernelArg(kernel, 1, sizeof(val), &val);}
 @i{    err |= clSetKernelArg(kernel, 2, sizeof(*factor), factor);}
 @i{    if (err) STARPU_OPENCL_REPORT_ERROR(err);}
 

+ 3 - 3
doc/chapters/vector_scal_cuda.texi

@@ -2,13 +2,13 @@
 
 @c This file is part of the StarPU Handbook.
 @c Copyright (C) 2009-2012  Université de Bordeaux 1
-@c Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+@c Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
 @c See the file starpu.texi for copying conditions.
 
 @smallexample
 #include <starpu.h>
 
-static __global__ void vector_mult_cuda(float *val, unsigned n,
+static __global__ void vector_mult_cuda(unsigned n, float *val,
                                         float factor)
 @{
         unsigned i =  blockIdx.x*blockDim.x + threadIdx.x;
@@ -28,7 +28,7 @@ extern "C" void scal_cuda_func(void *buffers[], void *_args)
         unsigned nblocks = (n + threads_per_block-1) / threads_per_block;
 
         vector_mult_cuda<<<nblocks,threads_per_block, 0, starpu_cuda_get_local_stream()>>>
-	                (val, n, *factor);
+	                (n, val, *factor);
 
         cudaStreamSynchronize(starpu_cuda_get_local_stream());
 @}

+ 3 - 3
doc/chapters/vector_scal_opencl.texi

@@ -2,7 +2,7 @@
 
 @c This file is part of the StarPU Handbook.
 @c Copyright (C) 2009-2011  Université de Bordeaux 1
-@c Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+@c Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
 @c See the file starpu.texi for copying conditions.
 
 @smallexample
@@ -30,8 +30,8 @@ void scal_opencl_func(void *buffers[], void *_args)
                                     devid);
     if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
 
-    err = clSetKernelArg(kernel, 0, sizeof(val), &val);
-    err |= clSetKernelArg(kernel, 1, sizeof(n), &n);
+    err = clSetKernelArg(kernel, 0, sizeof(n), &n);
+    err |= clSetKernelArg(kernel, 1, sizeof(val), &val);
     err |= clSetKernelArg(kernel, 2, sizeof(*factor), factor);
     if (err) STARPU_OPENCL_REPORT_ERROR(err);
 

+ 2 - 2
doc/chapters/vector_scal_opencl_codelet.texi

@@ -2,11 +2,11 @@
 
 @c This file is part of the StarPU Handbook.
 @c Copyright (C) 2009-2011  Université de Bordeaux 1
-@c Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+@c Copyright (C) 2010, 2011, 2013  Centre National de la Recherche Scientifique
 @c See the file starpu.texi for copying conditions.
 
 @smallexample
-__kernel void vector_mult_opencl(__global float* val, int nx, float factor)
+__kernel void vector_mult_opencl(int nx, __global float* val, float factor)
 @{
         const int i = get_global_id(0);
         if (i < nx) @{