| [6267964] | 1 | use demoCL in Xcode to get hardware info (driver version openCL 1.1)
|
|---|
| [e01b89d] | 2 |
|
|---|
| 3 | square.c
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 | Types:
|
|---|
| 7 | size_t
|
|---|
| 8 | cl_device_id
|
|---|
| 9 | cl_context
|
|---|
| 10 | cl_command_queue
|
|---|
| 11 | cl_program
|
|---|
| 12 | cl_kernel
|
|---|
| 13 |
|
|---|
| 14 | cl_mem
|
|---|
| 15 | Types for now are just structs, see cl.h
|
|---|
| 16 | ------Above this line are implemented-------
|
|---|
| 17 | Hardware methods:
|
|---|
| 18 |
|
|---|
| 19 | methods are externs
|
|---|
| 20 | Declared but not defined unless given one
|
|---|
| 21 |
|
|---|
| 22 | clGetDeviceIDs
|
|---|
| 23 | uses int err, takes 5 parameters
|
|---|
| 24 | http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clGetDeviceIDs.html
|
|---|
| [4b7d11e] | 25 | [x]
|
|---|
| [e01b89d] | 26 |
|
|---|
| 27 | cl_int clGetPlatformIDs( cl_uint num_entries,
|
|---|
| 28 | cl_platform_id *platforms,
|
|---|
| 29 | cl_uint *num_platforms)
|
|---|
| 30 |
|
|---|
| 31 | clCreateContext
|
|---|
| 32 | uses a cl_context context, takes 6 parameters
|
|---|
| 33 | http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clCreateContext.html
|
|---|
| 34 | openCL uses them for commands, memory, program, kernel objects, executing kernels
|
|---|
| [0744ab0] | 35 | [x]
|
|---|
| [e01b89d] | 36 |
|
|---|
| 37 | Kernels and other:
|
|---|
| 38 | clCreateCommandQueue
|
|---|
| 39 | uses a cl_command_queue commands, takes 4 parameters
|
|---|
| 40 | uses &device_id and &err
|
|---|
| 41 | http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clCreateCommandQueue.html
|
|---|
| [1a54e12] | 42 | [x]
|
|---|
| [e01b89d] | 43 |
|
|---|
| 44 | clCreateProgramWithSource
|
|---|
| 45 | uses cl_program program, takes 5 parameters
|
|---|
| 46 | uses context
|
|---|
| [e8b328b] | 47 | -IN PROGRESS-
|
|---|
| 48 |
|
|---|
| 49 | clCreateProgramWithBinary
|
|---|
| [2259218] | 50 | [x], see clCreateProgramWithSource
|
|---|
| [e01b89d] | 51 |
|
|---|
| 52 | clBuildProgram
|
|---|
| [4b7d11e] | 53 | [x]
|
|---|
| [e01b89d] | 54 |
|
|---|
| [4b7d11e] | 55 | //clGetProgramBuildInfo
|
|---|
| [e01b89d] | 56 |
|
|---|
| 57 | clCreateKernel
|
|---|
| [4b7d11e] | 58 | [x]
|
|---|
| [e01b89d] | 59 |
|
|---|
| 60 | clCreateBuffer
|
|---|
| [4b7d11e] | 61 | []
|
|---|
| [e01b89d] | 62 |
|
|---|
| [851f3e26] | 63 | [6/17/14, 2:29:20 PM] Manchun Zheng: you'll need to malloc it every time you increase the size
|
|---|
| 64 | [6/17/14, 2:30:12 PM] Manchun Zheng: for example T* buffer = (T*) malloc(sizeof(T));
|
|---|
| 65 | [6/17/14, 2:30:33 PM] Manchun Zheng: then when you want to add a new T to buffer
|
|---|
| 66 | [6/17/14, 2:30:49 PM] Manchun Zheng: btw, you also need to keep track of the size of buffer.
|
|---|
| 67 | [6/17/14, 2:30:55 PM] Manchun Zheng: so initially, size = 1;
|
|---|
| 68 | [6/17/14, 2:31:00 PM] Manchun Zheng: when you add a new T
|
|---|
| 69 | [6/17/14, 2:31:17 PM] Jean Jacques Rousseau: ah, got it
|
|---|
| 70 | [6/17/14, 2:31:44 PM] Manchun Zheng: you malloc by (size+ 1)*sizeof(T)
|
|---|
| 71 | [6/17/14, 2:31:52 PM] Manchun Zheng: and then you copy the previous data
|
|---|
| 72 | [6/17/14, 2:31:55 PM] Manchun Zheng: and add the new data
|
|---|
| 73 |
|
|---|
| [e01b89d] | 74 | clEnqueueWriteBuffer
|
|---|
| [4b7d11e] | 75 | []
|
|---|
| [e01b89d] | 76 |
|
|---|
| 77 | clSetKernelArg
|
|---|
| [4b7d11e] | 78 | []
|
|---|
| [e01b89d] | 79 |
|
|---|
| 80 | clGetKernelWorkGroupInfo
|
|---|
| [4b7d11e] | 81 | []
|
|---|
| [e01b89d] | 82 |
|
|---|
| 83 | clEnqueueReadBuffer
|
|---|
| [4b7d11e] | 84 | []
|
|---|
| [e01b89d] | 85 |
|
|---|
| 86 | clReleaseMemObject
|
|---|
| [4b7d11e] | 87 | []
|
|---|
| [e01b89d] | 88 |
|
|---|
| 89 | clReleaseProgram
|
|---|
| [4b7d11e] | 90 | []
|
|---|
| [e01b89d] | 91 |
|
|---|
| 92 | clReleaseKernel
|
|---|
| [4b7d11e] | 93 | []
|
|---|
| [e01b89d] | 94 |
|
|---|
| 95 | clReleaseCommandQueue
|
|---|
| [4b7d11e] | 96 | []
|
|---|
| [e01b89d] | 97 |
|
|---|
| 98 | clReleaseContext
|
|---|
| [4b7d11e] | 99 | []
|
|---|
| 100 |
|
|---|
| 101 | Kernel code changes
|
|---|
| 102 | [6/17/14, 12:34:48 PM] Jean Jacques Rousseau: oh, right
|
|---|
| 103 | [6/17/14, 12:35:48 PM] Jean Jacques Rousseau: although, I think I found it
|
|---|
| 104 | [6/17/14, 12:36:04 PM] Jean Jacques Rousseau: this Comm is a struct, and one of the fields is storing the rank
|
|---|
| 105 | [6/17/14, 12:36:12 PM] Jean Jacques Rousseau: when you make it, put in the rank yourself
|
|---|
| [e01b89d] | 106 |
|
|---|
| [2259218] | 107 | flam naught shy stub
|
|---|
| 108 | bash
|
|---|
| [851f3e26] | 109 | Done: clGetDeviceIDs, clCreateKernel, clCreateBuffer
|
|---|
| [4b7d11e] | 110 |
|
|---|
| 111 | ToDo:
|
|---|
| [2259218] | 112 |
|
|---|
| [4b7d11e] | 113 | Problems:
|
|---|
| [851f3e26] | 114 | Alterations to clGetDeviceIDs, slight problems with structs and pointers combined
|
|---|
| 115 | Found a bug with size_t
|
|---|
| [18bdd94] | 116 | Baffled by behavior that turned out to be caused by verify taking multiple paths
|
|---|
| [851f3e26] | 117 |
|
|---|
| 118 | Possible simplified implementation?
|
|---|
| 119 | Instead of buffers just turn them into straight variables
|
|---|
| 120 | May lose some power, can't use sizeof(type) * number
|
|---|
| 121 |
|
|---|
| 122 | CIVL code to consider:
|
|---|
| 123 | $proc is like a processid, but not an int
|
|---|
| 124 | $proc_null($proc *p);
|
|---|
| 125 |
|
|---|
| 126 | $self, refers to self
|
|---|
| 127 |
|
|---|
| 128 | $spawn f(expr,...,exprn);
|
|---|
| 129 | or
|
|---|
| 130 | $proc p = $spawn f(i);
|
|---|
| 131 |
|
|---|
| 132 | $gbarrier or $barrier (one is global) |
|---|