- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi people
Im strugging on my code because i need long double and double variables, but when i print these variables the values are wrong. My guess is that the board doesn't support double variables, its a terasic de5net and shows these stats on getDeviceInfo: Querying platform for info: ========================== CL_PLATFORM_NAME = Intel(R) FPGA SDK for OpenCL(TM) CL_PLATFORM_VENDOR = Intel(R) Corporation CL_PLATFORM_VERSION = OpenCL 1.0 Intel(R) FPGA SDK for OpenCL(TM), Version 17.0.2 Querying device for info: ======================== CL_DEVICE_NAME = de5net_a7 : Terasic's Preferred Board CL_DEVICE_VENDOR = Terasic Corporation CL_DEVICE_VENDOR_ID = 4466 CL_DEVICE_VERSION = OpenCL 1.0 Intel(R) FPGA SDK for OpenCL(TM), Version 17.0.2 CL_DRIVER_VERSION = 17.0 CL_DEVICE_ADDRESS_BITS = 64 CL_DEVICE_AVAILABLE = true CL_DEVICE_ENDIAN_LITTLE = true CL_DEVICE_GLOBAL_MEM_CACHE_SIZE = 32768 CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE = 0 CL_DEVICE_GLOBAL_MEM_SIZE = 0 CL_DEVICE_IMAGE_SUPPORT = true CL_DEVICE_LOCAL_MEM_SIZE = 16384 CL_DEVICE_MAX_CLOCK_FREQUENCY = 1000 CL_DEVICE_MAX_COMPUTE_UNITS = 1 CL_DEVICE_MAX_CONSTANT_ARGS = 8 CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE = 1073741824 CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 3 CL_DEVICE_MEM_BASE_ADDR_ALIGN = 8192 CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE = 1024 CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR = 4 CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT = 2 CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT = 1 CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG = 1 CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT = 1 CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE = 0 Command queue out of order? = false Command queue profiling enabled? = trueLink Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have that board too and I can use doubles no problem. Try to paste the code here to understand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- I have that board too and I can use doubles no problem. Try to paste the code here to understand. --- Quote End ---
Host code (Visual Studio):
typedef struct ocl_block{
int score;
cl_int4 args;
cl_double sig;
cl_double val;
char padding;
} ocl_block;
....
b_dump = (ocl_block *) malloc(sizeof(ocl_block));
b_dump->score = 7;
b_dump->args.x = 67;
b_dump->args.y = 52;
b_dump->args.z = 10;
b_dump->args.w = 59;
b_dump->val= 6.141592653589793238;
b_dump->sig = 86.141592653589793238;
buf_blocks = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(ocl_block) , NULL, &status);
status = clEnqueueWriteBuffer(cmd_queue, buf_blocks, CL_TRUE, 0, sizeof(ocl_block), b_dump, 0, NULL, NULL);
buffers = buf_blocks;
Kernel code
struct __attribute__((packed)) block{
int score;
int4 args;
double sig;
double val;
char padding;
};
__kernel void cluster_k(__global struct block * restrict bb){
double hu = 3.141592653589793238;
printf("Block: score:%d\targs:%d,%d,%d,%d \n", bb->score,bb->args.s0, bb->args.s1, bb->args.s2, bb->args.s3);
printf("sizeof: %lf %f\n", hu,hu);
printf("val: %lf",bb->pvalue);
printf("sig: %lf",bb->significance);
}
I get this: Block: score:7 args:67,52,10,59 hu: 3.141593 3.141593 val: -0.000000 sig: -39273368158627109000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000.000000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your problem is most certainly not related to the board/hardware. Have you tried running your code in the emulator and see what happens? If you get the same incorrect results in the emulator, then there is some bug in your code. If the output is correct in the emulator, but incorrect on the board, then it might be caused by a bug in the compiler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Your problem is most certainly not related to the board/hardware. Have you tried running your code in the emulator and see what happens? If you get the same incorrect results in the emulator, then there is some bug in your code. If the output is correct in the emulator, but incorrect on the board, then it might be caused by a bug in the compiler. --- Quote End --- Hi HRZ! i run it on the emulator, now i get the right results simply by move the double struct fields to the top.. i dont get it but ok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, problem solved then. :D
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page