/* * domains.h * * Created on: 06/01/2017 * Author: pedro */ #ifndef SRC_DOMAINS_H_ #define SRC_DOMAINS_H_ // Host configuration #ifndef __OPENCL_VERSION__ #include #include #include #include "CL/cl.h" #include "CL/cl_platform.h" // when interval domains are used typedef cl_ushort2 interval; // [16-bits;16-bits] <-> [min,max] // Bitmap size used on host #ifndef BITS #define BITS 1024 #endif // Size of words used on host #ifndef H_WORD #define H_WORD 64 #endif // host word parameters #if H_WORD < 33 #define H_ONE 1U #define H_DIV 5 #define H_WORD_TYPE unsigned int #else #define H_ONE 1ULL #define H_DIV 6 #define H_WORD_TYPE cl_ulong #endif #define H_ALL_ONES ((H_WORD_TYPE) -1) #if BITS < 33 #define H_N_WORDS 1 #define H_BITS 32 #elif BITS < 65 #if H_WORD == 64 #define H_N_WORDS 1 #else #define H_N_WORDS 2 #endif #define H_BITS 64 #else #if (BITS % 64) > 0 #define H_BITS (BITS / 64 * 64 + 64) #else #define H_BITS (BITS / 64 * 64) #endif #define H_N_WORDS H_BITS / H_WORD #endif #if H_N_WORDS == 1 typedef H_WORD_TYPE bitmap; #else typedef H_WORD_TYPE bitmap[H_N_WORDS]; #endif // never used. Just for compilation and syntax correction #define CL_BITMAP 0 #define CL_INTERVAL 1 #define CL_D_TYPE CL_BITMAP #define DOMAIN_ cl_bitmap #define CL_D_MIN 0 // 32 bits 1 word #define CL_WORD 32 #define CL_BITS 32 #define CL_D_MAX 32 #define CL_ONE_ 1U #define CL_DIV 5 #define CL_REM 31 #define CL_N_WORDS 1 #define CL_WORD_TYPE cl_uint typedef CL_WORD_TYPE cl_bitmap; /* // 64 bits 1 word #define CL_WORD 64 #define CL_BITS 64 #define CL_D_MAX 64 #define CL_ONE_ 1UL #define CL_DIV 6 #define CL_REM 63 #define CL_N_WORDS 1 #define CL_WORD_TYPE cl_ulong typedef CL_WORD_TYPE cl_bitmap; */ /* // 64 bits 2 words #define CL_WORD 64 #define CL_BITS 128 #define CL_D_MAX 128 #define CL_ONE_ 1UL #define CL_DIV 6 #define CL_REM 63 #define CL_N_WORDS 2 #define CL_WORD_TYPE cl_ulong typedef CL_WORD_TYPE cl_bitmap[CL_N_WORDS]; */ #define CL_ALL_ONES ((CL_WORD_TYPE) -1) // Device configuration (used during kernel compilation) #else // Choose domains size on OpenCL kernel compilation // host word parameters #if CL_WORD < 33 #define CL_ONE_ 1U #define CL_DIV 5 #define CL_REM 31 #define CL_WORD_TYPE uint #else #define CL_ONE_ 1UL #define CL_DIV 6 #define CL_REM 63 #define CL_WORD_TYPE ulong #endif #define CL_ALL_ONES ((CL_WORD_TYPE) -1) #if CL_BITS < 33 #define CL_N_WORDS 1 #elif CL_BITS < 65 #if CL_WORD == 32 #define CL_N_WORDS 2 #else #define CL_N_WORDS 1 #endif #else #define CL_N_WORDS (CL_BITS / CL_WORD) #endif #if CL_N_WORDS == 1 typedef CL_WORD_TYPE cl_bitmap; #else typedef CL_WORD_TYPE cl_bitmap[CL_N_WORDS]; #endif #define CL_BITMAP 0 #define CL_INTERVAL 1 #ifndef CL_D_TYPE #define CL_D_TYPE CL_BITMAP #endif #if CL_D_TYPE == CL_BITMAP #define DOMAIN_ cl_bitmap #define VARS cl_var_bitmap #define VARS_PROP cl_var_p_bitmap #elif CL_D_TYPE == CL_INTERVAL typedef ushort2 interval;// [16-bits;16-bits] <-> [min,max] #define DOMAIN_ interval #define VARS cl_var_interval #define VARS_PROP cl_var_p_interval #endif #ifndef CL_D_MAX #define CL_D_MAX 32 #endif #ifndef CL_D_MIN #define CL_D_MIN 0 #endif #endif #endif /* SRC_DOMAINS_H_ */