Browse Source

examples/filters/fblock: reorganise source code

Nathalie Furmento 15 years ago
parent
commit
01774169b9
3 changed files with 4 additions and 26 deletions
  1. 2 3
      examples/Makefile.am
  2. 2 19
      examples/filters/fblock.c
  3. 0 4
      examples/filters/fblock_opencl_codelet.cl

+ 2 - 3
examples/Makefile.am

@@ -31,7 +31,6 @@ BUILT_SOURCES =
 
 EXTRA_DIST = 					\
 	basic_examples/vector_scal_opencl_codelet.cl \
-	cuda/incrementer_cuda.cu		\
 	spmv/spmv_cuda.cu			\
 	gordon/null_kernel_gordon.c		\
 	mult/xgemm.c				\
@@ -114,7 +113,6 @@ noinst_HEADERS = 				\
 	common/blas.h				\
 	mult/dw_mult.h				\
 	mult/gordon/func_sgemm_ibm.h		\
-	cuda/incrementer_cuda.h			\
 	gordon/null.h				\
 	fortran/bindings/StarPU_fortran.h	\
 	ppm_downscaler/ppm_downscaler.h		\
@@ -174,7 +172,8 @@ filters_fvector_SOURCES =			\
 	filters/fvector.c
 
 filters_fblock_SOURCES =			\
-	filters/fblock.c
+	filters/fblock.c			\
+	filters/fblock_cpu.c
 
 if STARPU_USE_CUDA
 filters_fblock_SOURCES +=			\

+ 2 - 19
examples/filters/fblock.c

@@ -22,6 +22,8 @@
 #define NZ    3
 #define PARTS 2
 
+extern void cpu_func(void *buffers[], void *cl_arg);
+
 #ifdef STARPU_USE_CUDA
 extern void cuda_func(void *buffers[], void *cl_arg);
 #endif
@@ -30,25 +32,6 @@ extern void cuda_func(void *buffers[], void *cl_arg);
 extern void opencl_func(void *buffers[], void *cl_arg);
 #endif
 
-void cpu_func(void *buffers[], void *cl_arg)
-{
-        unsigned i, j, k;
-        int *factor = cl_arg;
-	int *block = (int *)STARPU_BLOCK_GET_PTR(buffers[0]);
-	int nx = (int)STARPU_BLOCK_GET_NX(buffers[0]);
-	int ny = (int)STARPU_BLOCK_GET_NY(buffers[0]);
-	int nz = (int)STARPU_BLOCK_GET_NZ(buffers[0]);
-        unsigned ldy = STARPU_BLOCK_GET_LDY(buffers[0]);
-        unsigned ldz = STARPU_BLOCK_GET_LDZ(buffers[0]);
-
-        for(k=0; k<nz ; k++) {
-                for(j=0; j<ny ; j++) {
-                        for(i=0; i<nx ; i++)
-                                block[(k*ldz)+(j*ldy)+i] = *factor;
-                }
-        }
-}
-
 void print_block(int *block, int nx, int ny, int nz, unsigned ldy, unsigned ldz)
 {
         int i, j, k;

+ 0 - 4
examples/filters/fblock_opencl_codelet.cl

@@ -23,8 +23,4 @@ __kernel void fblock_opencl(__global int* block, int nx, int ny, int nz, unsigne
                                 block[(k*ldz)+(j*ldy)+i] = factor;
                 }
         }
-//        const int i = get_global_id(0);
-//        if (i < nx*ny*nz) {
-//                block[i] = factor;//10*(factor+1);
-//        }
 }