Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/pure-cfg/test/MIP/mip_opencl.c
ViewVC logotype

Diff of /branches/pure-cfg/test/MIP/mip_opencl.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 302, Tue Aug 17 03:52:21 2010 UTC revision 310, Tue Aug 17 18:52:00 2010 UTC
# Line 7  Line 7 
7   *   *
8   * To View the Image   * To View the Image
9   * =========================   * =========================
10   * ./unu reshape -i mip.txt -s 200 200 | ./unu quantize -b 8 -o new.png   * unu reshape -i mip.txt -s 200 200 | unu quantize -b 8 -o new.png
11   */   */
12  #include <OpenCL/OpenCl.h>  #include <OpenCL/OpenCl.h>
13  #include <assert.h>  #include <assert.h>
# Line 17  Line 17 
17  #include <sys/stat.h>  #include <sys/stat.h>
18  #include <teem/nrrd.h>  #include <teem/nrrd.h>
19    
20  #define SIZE 200  #define SIZE 640
21    
22  //Loads the Kernel from a file  //Loads the Kernel from a file
23  char * loadKernel (const char * filename)  char * loadKernel (const char * filename)
# Line 59  Line 59 
59                  max = matrix[i];                  max = matrix[i];
60    
61     }     }
    printf("Max: %f\n",max);  
62     fclose(out_file);     fclose(out_file);
63    
64    
# Line 312  Line 311 
311    
312          size_t global_work_size[2], local_work_size[2];          size_t global_work_size[2], local_work_size[2];
313    
314          global_work_size[0] = 256;          global_work_size[0] = SIZE;
315          global_work_size[1] = 256;          global_work_size[1] = SIZE;
316    
317          local_work_size[0] = 1;          local_work_size[0] = 1;
318          local_work_size[1] = 1;          local_work_size[1] = 1;
# Line 328  Line 327 
327          err |=clSetKernelArg(kernel,index++,sizeof(cl_int2), &workDim);          err |=clSetKernelArg(kernel,index++,sizeof(cl_int2), &workDim);
328          err |=clSetKernelArg(kernel,index++,sizeof(cl_mem), &sAxis_mem);          err |=clSetKernelArg(kernel,index++,sizeof(cl_mem), &sAxis_mem);
329    
         printf("error:%d\n",err);  
330          assert(err == CL_SUCCESS);          assert(err == CL_SUCCESS);
331    
332    
# Line 352  Line 350 
350    
351          return CL_SUCCESS;          return CL_SUCCESS;
352  }  }
353    
354  int main (int argc, char ** argv)  int main (int argc, char ** argv)
355  {  {
356          char * dataFile = "txs.nrrd";          char * dataFile = "../../data/txs.nrrd";
357          float transformMatrix[16];          float transformMatrix[16];
358          float inverseMatrix[16];          float inverseMatrix[16];
359    
360            if (argc == 2) {
361                dataFile = argv[1];
362            }
363    
364          float * out;          float * out;
365          out = (float *) malloc(sizeof(float) * (SIZE * SIZE));          out = (float *) malloc(sizeof(float) * (SIZE * SIZE));
366          Nrrd * nin = loadNrrdFile(dataFile);          Nrrd * nin = loadNrrdFile(dataFile);

Legend:
Removed from v.302  
changed lines
  Added in v.310

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0