Commit 08197fa4 authored by Leonardo Solis's avatar Leonardo Solis
Browse files

qualified conform orientations as __constant


Former-commit-id: d9646916
parent 02c94681
......@@ -21,16 +21,23 @@ void Krnl_Conform(
unsigned char Host_num_of_rotbonds,
#if defined (FIXED_POINT_CONFORM)
/*
fixedpt ref_orientation_quats_const_0, // must be formatted in host
fixedpt ref_orientation_quats_const_1, // must be formatted in host
fixedpt ref_orientation_quats_const_2, // must be formatted in host
fixedpt ref_orientation_quats_const_3 // must be formatted in host
*/
__constant fixedpt4* restrict KerConstStatic_ref_orientation_quats_const,
#else
/*
float ref_orientation_quats_const_0,
float ref_orientation_quats_const_1,
float ref_orientation_quats_const_2,
float ref_orientation_quats_const_3
*/
__constant float4* restrict KerConstStatic_ref_orientation_quats_const,
#endif
unsigned short Host_RunId
)
{
#if defined (DEBUG_KRNL_Conform)
......@@ -85,6 +92,20 @@ void Krnl_Conform(
rotbonds_unit_vectors_localcache [c] = KerConstStatic_rotbonds_unit_vectors_const [c];
}
#if defined (FIXED_POINT_CONFORM)
fixedpt4 ref_orientation_quats_const = KerConstStatic_ref_orientation_quats_const[Host_RunId];
fixedpt ref_orientation_quats_const_0 = ref_orientation_quats_const.x;
fixedpt ref_orientation_quats_const_1 = ref_orientation_quats_const.y;
fixedpt ref_orientation_quats_const_2 = ref_orientation_quats_const.z;
fixedpt ref_orientation_quats_const_3 = ref_orientation_quats_const.w;
#else
float4 ref_orientation_quats_const = KerConstStatic_ref_orientation_quats_const[Host_RunId];
float ref_orientation_quats_const_0 = ref_orientation_quats_const.x;
float ref_orientation_quats_const_1 = ref_orientation_quats_const.y;
float ref_orientation_quats_const_2 = ref_orientation_quats_const.z;
float ref_orientation_quats_const_3 = ref_orientation_quats_const.w;
#endif
#pragma max_concurrency 32
while(active) {
char mode;
......
......@@ -149,10 +149,12 @@ typedef struct
#if defined(SINGLE_COPY_POP_ENE)
#if defined (FIXED_POINT_CONFORM)
// fixed-point
fixedpt ref_orientation_quats_const [4*MAX_NUM_OF_RUNS] __attribute__ ((aligned (512)));
//fixedpt ref_orientation_quats_const [4*MAX_NUM_OF_RUNS] __attribute__ ((aligned (512)));
cl_int4 ref_orientation_quats_const [MAX_NUM_OF_RUNS] __attribute__ ((aligned (512)));
#else
// floating-point (original)
float ref_orientation_quats_const [4*MAX_NUM_OF_RUNS] __attribute__ ((aligned (512)));
//float ref_orientation_quats_const [4*MAX_NUM_OF_RUNS] __attribute__ ((aligned (512)));
cl_float4 ref_orientation_quats_const [MAX_NUM_OF_RUNS] __attribute__ ((aligned (512)));
#endif
#endif
} kernelconstant_static;
......
......@@ -463,16 +463,28 @@ int prepare_conststatic_fields_for_gpu(Liganddata* myligand_reference,
#if defined (FIXED_POINT_CONFORM)
// fixed-point
/*
KerConstStatic->ref_orientation_quats_const[4*i] = fixedpt_fromfloat(cosf(genrotangle/2.0f)); //q
KerConstStatic->ref_orientation_quats_const[4*i+1] = fixedpt_fromfloat(sinf(genrotangle/2.0f)*sinf(theta)*cosf(phi)); //x
KerConstStatic->ref_orientation_quats_const[4*i+2] = fixedpt_fromfloat(sinf(genrotangle/2.0f)*sinf(theta)*sinf(phi)); //y
KerConstStatic->ref_orientation_quats_const[4*i+3] = fixedpt_fromfloat(sinf(genrotangle/2.0f)*cosf(theta)); //z
*/
KerConstStatic->ref_orientation_quats_const[i].x = fixedpt_fromfloat(cosf(genrotangle/2.0f)); //q
KerConstStatic->ref_orientation_quats_const[i].y = fixedpt_fromfloat(sinf(genrotangle/2.0f)*sinf(theta)*cosf(phi)); //x
KerConstStatic->ref_orientation_quats_const[i].z = fixedpt_fromfloat(sinf(genrotangle/2.0f)*sinf(theta)*sinf(phi)); //y
KerConstStatic->ref_orientation_quats_const[i].w = fixedpt_fromfloat(sinf(genrotangle/2.0f)*cosf(theta)); //z
#else
// floating-point (original)
/*
KerConstStatic->ref_orientation_quats_const[4*i] = cosf(genrotangle/2.0f); //q
KerConstStatic->ref_orientation_quats_const[4*i+1] = sinf(genrotangle/2.0f)*sinf(theta)*cosf(phi); //x
KerConstStatic->ref_orientation_quats_const[4*i+2] = sinf(genrotangle/2.0f)*sinf(theta)*sinf(phi); //y
KerConstStatic->ref_orientation_quats_const[4*i+3] = sinf(genrotangle/2.0f)*cosf(theta); //z
*/
KerConstStatic->ref_orientation_quats_const[i].x = cosf(genrotangle/2.0f); //q
KerConstStatic->ref_orientation_quats_const[i].y = sinf(genrotangle/2.0f)*sinf(theta)*cosf(phi); //x
KerConstStatic->ref_orientation_quats_const[i].z = sinf(genrotangle/2.0f)*sinf(theta)*sinf(phi); //y
KerConstStatic->ref_orientation_quats_const[i].w = sinf(genrotangle/2.0f)*cosf(theta); //z
#endif
}
#endif
......
......@@ -330,7 +330,8 @@ cl_mem mem_KerConstStatic_dspars_V_const;
cl_mem mem_KerConstStatic_rotlist_const;
cl_mem mem_KerConstStatic_ref_coords_const;
cl_mem mem_KerConstStatic_rotbonds_moving_vectors_const;
cl_mem mem_KerConstStatic_rotbonds_unit_vectors_const;
cl_mem mem_KerConstStatic_rotbonds_unit_vectors_const;
cl_mem mem_KerConstStatic_ref_orientation_quats_const;
/* // Nr elements // Nr bytes
cl_mem mem_atom_charges_const; // float [MAX_NUM_OF_ATOMS]; // 90 = 90 //360
......@@ -647,13 +648,15 @@ printf("%i %i\n", dockpars.num_of_intraE_contributors, myligand_reference.num_of
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ROTATIONS*sizeof(fixedpt), &mem_KerConstStatic_rotlist_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ATOMS*sizeof(cl_int3), &mem_KerConstStatic_ref_coords_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ROTBONDS*sizeof(cl_int3), &mem_KerConstStatic_rotbonds_moving_vectors_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ROTBONDS*sizeof(cl_int3), &mem_KerConstStatic_rotbonds_unit_vectors_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ROTBONDS*sizeof(cl_int3), &mem_KerConstStatic_rotbonds_unit_vectors_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_RUNS*sizeof(cl_int4), &mem_KerConstStatic_ref_orientation_quats_const);
#else
// floating-point (original)
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ROTATIONS*sizeof(int), &mem_KerConstStatic_rotlist_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ATOMS*sizeof(cl_float3), &mem_KerConstStatic_ref_coords_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ROTBONDS*sizeof(cl_float3), &mem_KerConstStatic_rotbonds_moving_vectors_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ROTBONDS*sizeof(cl_float3), &mem_KerConstStatic_rotbonds_unit_vectors_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ROTBONDS*sizeof(cl_float3), &mem_KerConstStatic_rotbonds_unit_vectors_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_RUNS*sizeof(cl_float4), &mem_KerConstStatic_ref_orientation_quats_const);
#endif
//#if defined (FIXED_POINT_INTERE)
......@@ -705,13 +708,15 @@ printf("%i %i\n", dockpars.num_of_intraE_contributors, myligand_reference.num_of
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_rotlist_const, &KerConstStatic.rotlist_const[0], MAX_NUM_OF_ROTATIONS*sizeof(fixedpt));
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_ref_coords_const, &KerConstStatic.ref_coords_const[0], MAX_NUM_OF_ATOMS*sizeof(cl_int3));
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_rotbonds_moving_vectors_const, &KerConstStatic.rotbonds_moving_vectors_const[0], MAX_NUM_OF_ROTBONDS*sizeof(cl_int3));
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_rotbonds_unit_vectors_const, &KerConstStatic.rotbonds_unit_vectors_const[0], MAX_NUM_OF_ROTBONDS*sizeof(cl_int3));
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_rotbonds_unit_vectors_const, &KerConstStatic.rotbonds_unit_vectors_const[0], MAX_NUM_OF_ROTBONDS*sizeof(cl_int3));
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_ref_orientation_quats_const, &KerConstStatic.ref_orientation_quats_const[0], MAX_NUM_OF_RUNS*sizeof(cl_int4));
#else
// floating-point (original)
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_rotlist_const, &KerConstStatic.rotlist_const[0], MAX_NUM_OF_ROTATIONS*sizeof(int));
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_ref_coords_const, &KerConstStatic.ref_coords_const[0], MAX_NUM_OF_ATOMS*sizeof(cl_float3));
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_rotbonds_moving_vectors_const, &KerConstStatic.rotbonds_moving_vectors_const[0], MAX_NUM_OF_ROTBONDS*sizeof(cl_float3));
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_rotbonds_unit_vectors_const, &KerConstStatic.rotbonds_unit_vectors_const[0], MAX_NUM_OF_ROTBONDS*sizeof(cl_float3));
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_rotbonds_unit_vectors_const, &KerConstStatic.rotbonds_unit_vectors_const[0], MAX_NUM_OF_ROTBONDS*sizeof(cl_float3));
memcopyBufferObjectToDevice(command_queue1,mem_KerConstStatic_ref_orientation_quats_const, &KerConstStatic.ref_orientation_quats_const[0], MAX_NUM_OF_RUNS*sizeof(cl_float4));
#endif
//#if defined (FIXED_POINT_INTERE)
......@@ -813,7 +818,7 @@ printf("%i %i\n", dockpars.num_of_intraE_contributors, myligand_reference.num_of
setKernelArg(kernel2,5, sizeof(unsigned char), &dockpars.num_of_atoms);
setKernelArg(kernel2,6, sizeof(unsigned char), &dockpars.num_of_genes);
setKernelArg(kernel2,7, sizeof(unsigned char), &num_rotbonds);
setKernelArg(kernel2,8, sizeof(mem_KerConstStatic_ref_orientation_quats_const), &mem_KerConstStatic_ref_orientation_quats_const);
#if defined(SINGLE_COPY_POP_ENE)
#else
......@@ -1109,10 +1114,10 @@ unsigned char Host_cons_limit = (unsigned char) dockpars.cons_limit;
#endif
#endif
#ifdef ENABLE_KERNEL2 // Krnl_Conform
#ifdef ENABLE_KERNEL2 // Krnl_Conform
/*
#if defined(SINGLE_COPY_POP_ENE)
#if defined (FIXED_POINT_CONFORM)
// fixed-point
setKernelArg(kernel2,8, sizeof(fixedpt), &KerConstStatic.ref_orientation_quats_const[4*run_cnt]);
setKernelArg(kernel2,9, sizeof(fixedpt), &KerConstStatic.ref_orientation_quats_const[4*run_cnt + 1]);
setKernelArg(kernel2,10, sizeof(fixedpt), &KerConstStatic.ref_orientation_quats_const[4*run_cnt + 2]);
......@@ -1125,7 +1130,6 @@ unsigned char Host_cons_limit = (unsigned char) dockpars.cons_limit;
#endif
#else
#if defined (FIXED_POINT_CONFORM)
// fixed-point
setKernelArg(kernel2,8, sizeof(fixedpt), &KerConstDynamic.ref_orientation_quats_const[0]);
setKernelArg(kernel2,9, sizeof(fixedpt), &KerConstDynamic.ref_orientation_quats_const[1]);
setKernelArg(kernel2,10, sizeof(fixedpt), &KerConstDynamic.ref_orientation_quats_const[2]);
......@@ -1136,7 +1140,9 @@ unsigned char Host_cons_limit = (unsigned char) dockpars.cons_limit;
setKernelArg(kernel2,10, sizeof(float), &KerConstDynamic.ref_orientation_quats_const[2]);
setKernelArg(kernel2,11, sizeof(float), &KerConstDynamic.ref_orientation_quats_const[3]);
#endif
#endif
#endif
*/
setKernelArg(kernel2,9, sizeof(unsigned short), &run_cnt);
#endif // End of ENABLE_KERNEL2
......@@ -2213,7 +2219,8 @@ void cleanup() {
if(mem_KerConstStatic_rotlist_const) {clReleaseMemObject(mem_KerConstStatic_rotlist_const);}
if(mem_KerConstStatic_ref_coords_const) {clReleaseMemObject(mem_KerConstStatic_ref_coords_const);}
if(mem_KerConstStatic_rotbonds_moving_vectors_const) {clReleaseMemObject(mem_KerConstStatic_rotbonds_moving_vectors_const);}
if(mem_KerConstStatic_rotbonds_unit_vectors_const) {clReleaseMemObject(mem_KerConstStatic_rotbonds_unit_vectors_const);}
if(mem_KerConstStatic_rotbonds_unit_vectors_const) {clReleaseMemObject(mem_KerConstStatic_rotbonds_unit_vectors_const);}
if(mem_KerConstStatic_ref_orientation_quats_const) {clReleaseMemObject(mem_KerConstStatic_ref_orientation_quats_const);}
if(mem_dockpars_fgrids) {clReleaseMemObject(mem_dockpars_fgrids);}
#if defined(SEPARATE_FGRID_INTERE)
......
......@@ -398,7 +398,7 @@ freq: 169 MHz (exe slower with wrong results)
freq: 185 MHz (67 sec non-instrumented on 10runs 3ptb, 144 sec on 1stp (from 166))
>>> commit "redefined constant args + reduced scope genos in IGLkrnl"
139. `Krnl_Prng_LS123_ushort`: added code to generate 3 different entitid id for LS for-loop
139. `Krnl_Prng_LS123_ushort`: added code to generate 3 different entity id for LS for-loop
(it was initially producing same entity id causing overwriting)
140. `Krnl_GA`: code cleaned up + reduced scope of LocalPopNext and LocalEneNext (reduces logic usage)
......@@ -406,6 +406,20 @@ freq: 185 MHz (67 sec non-instrumented on 10runs 3ptb, 144 sec on 1stp (from 166
NO HW BUILT
>>> commit "reduced scope of Next Pop and Ene"
141. `performdocking.cpp`
`Krnl_Conform`: pass ref_orientation_quats_const as fixedpt4 or float4 to __constant only once before performdocking main-loop
rather than passing 4 elements on every main-loop performdocking iteration
freq: 190 MHz (64 sec non-instrumented on 10runs 3ptb, 141 sec on 1stp)(instrumented freq: 197 MHz)
>>> commit "qualified conform orientations as __constant"
XXX, Between Conform and InterE, IntraE create a wider channel:
https://www.alteraforum.com/forum/showthread.php?t=55979
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment