Commit 5790e4d9 authored by Leonardo Solis's avatar Leonardo Solis

#39, cleaned host

parent b7355dd7
......@@ -110,10 +110,6 @@ static cl_kernel kernel_igl_arbiter = NULL;
static const char *name_krnl_igl_arbiter = "Krnl_IGL_Arbiter";
#endif
static cl_program program = NULL;
// Function prototypes
......@@ -125,10 +121,6 @@ static void device_info_bool ( cl_device_id device, cl_device_info param, const
static void device_info_string( cl_device_id device, cl_device_info param, const char* name);
static void display_device_info( cl_device_id device );
//// --------------------------------
//// Host constant struct
//// --------------------------------
......@@ -184,23 +176,6 @@ cl_mem mem_KerConstStatic_rotbonds_moving_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
cl_mem mem_atom_types_const; // char [MAX_NUM_OF_ATOMS]; // 90 = 90 //360
cl_mem mem_intraE_contributors_const; // char [3*MAX_INTRAE_CONTRIBUTORS]; // 3*8128=28384 //24384
cl_mem mem_VWpars_AC_const; // float [MAX_NUM_OF_ATYPES*MAX_NUM_OF_ATYPES]; // 14*14 = 196 //784
cl_mem mem_VWpars_BD_const; // float [MAX_NUM_OF_ATYPES*MAX_NUM_OF_ATYPES]; // 14*14 = 196 //784
cl_mem mem_dspars_S_const; // float [MAX_NUM_OF_ATYPES]; // 14 = 14 //56
cl_mem mem_dspars_V_const; // float [MAX_NUM_OF_ATYPES]; // 14 = 14 //56
cl_mem mem_rotlist_const; // int [MAX_NUM_OF_ROTATIONS]; // 4096 = 4096 //16384
cl_mem mem_ref_coords_x_const; // float [MAX_NUM_OF_ATOMS]; // 90 = 90 //360
cl_mem mem_ref_coords_y_const; // float [MAX_NUM_OF_ATOMS]; // 90 = 90 //360
cl_mem mem_ref_coords_z_const; // float [MAX_NUM_OF_ATOMS]; // 90 = 90 //360
cl_mem mem_rotbonds_moving_vectors_const;// float [3*MAX_NUM_OF_ROTBONDS]; // 3*32 = 96 //384
cl_mem mem_rotbonds_unit_vectors_const; // float [3*MAX_NUM_OF_ROTBONDS]; // 3*32 = 96 //384
cl_mem mem_ref_orientation_quats_const; // float [4*MAX_NUM_OF_RUNS]; // 4*100 = 400 //1600
*/
cl_mem mem_dockpars_fgrids;
#if defined(SEPARATE_FGRID_INTERE)
......@@ -210,9 +185,6 @@ cl_mem mem_dockpars_fgrids3;
cl_mem mem_dockpars_conformations_current;
cl_mem mem_dockpars_energies_current;
/*
cl_mem mem_dockpars_prng_states;
*/
#if defined(SINGLE_COPY_POP_ENE)
cl_mem mem_evals_performed;
......@@ -221,49 +193,6 @@ cl_mem mem_gens_performed;
cl_mem mem_evals_and_generations_performed;
#endif
//#if defined (FIXED_POINT_INTERE)
#if 0
//#include "defines_fixedpt_64.h"
fixedpt64* cpu_fixedpt64grids;
#endif
//// --------------------------------
//// Docking
//// --------------------------------
......@@ -301,13 +230,7 @@ filled with clock() */
printf("Init complete!\n"); fflush(stdout);
Liganddata myligand_reference;
//Dockparameters dockpars;
//#if defined (FIXED_POINT_INTERE)
#if 0
size_t size_fixedpt64grids;
#else
size_t size_floatgrids;
#if defined(SEPARATE_FGRID_INTERE)
......@@ -315,45 +238,46 @@ filled with clock() */
size_t size_floatgrids3;
#endif
#endif
size_t size_populations;
size_t size_energies;
size_t size_prng_seeds;
#if defined(SINGLE_COPY_POP_ENE)
#if defined(SINGLE_COPY_POP_ENE)
size_t size_evals_of_runs;
#endif
#endif
clock_t clock_start_docking;
clock_t clock_stop_docking;
clock_t clock_stop_program_before_clustering;
//allocating CPU memory for initial populations
#if defined(SINGLE_COPY_POP_ENE)
#if defined(SINGLE_COPY_POP_ENE)
size_populations = mypars->num_of_runs * mypars->pop_size * ACTUAL_GENOTYPE_LENGTH * sizeof(float);
#else
#else
//size_populations = mypars->pop_size * GENOTYPE_LENGTH_IN_GLOBMEM * sizeof(float);
size_populations = mypars->pop_size * ACTUAL_GENOTYPE_LENGTH * sizeof(float);
#endif
#endif
cpu_init_populations = (float*) alignedMalloc(size_populations);
memset(cpu_init_populations, 0, size_populations);
//allocating CPU memory for results
#if defined(SINGLE_COPY_POP_ENE)
#if defined(SINGLE_COPY_POP_ENE)
size_energies = mypars->num_of_runs * mypars->pop_size * sizeof(float);
#else
#else
size_energies = mypars->pop_size * sizeof(float);
#endif
#endif
cpu_energies = (float*) alignedMalloc(size_energies);
cpu_result_ligands = (Ligandresult*) alignedMalloc(sizeof(Ligandresult)*(mypars->num_of_runs));
cpu_final_populations = (float*) alignedMalloc(size_populations);
//allocating memory in CPU for reference orientation angles
#if defined(SINGLE_COPY_POP_ENE)
#if defined(SINGLE_COPY_POP_ENE)
cpu_ref_ori_angles = (float*) alignedMalloc(mypars->num_of_runs*3*sizeof(float));
#else
#else
cpu_ref_ori_angles = (float*) alignedMalloc(3*sizeof(float));
#endif
#endif
//generating initial populations and random orientation angles of reference ligand
//(ligand will be moved to origo and scaled as well)
......@@ -368,16 +292,14 @@ filled with clock() */
genseed(time(NULL)); //initializing seed generator
for (unsigned int i=0; i<num_of_prng_blocks*mypars->num_of_runs; i++) {
#if defined (REPRO)
#if defined (REPRO)
cpu_prng_seeds[i] = 1u;
#else
#else
cpu_prng_seeds[i] = genseed(0u);
#endif
#endif
}
//srand(time(NULL));
#if defined(SINGLE_COPY_POP_ENE)
#if defined(SINGLE_COPY_POP_ENE)
// allocating memory in CPU for evaluation counters
size_evals_of_runs = mypars->num_of_runs*sizeof(int);
cpu_evals_of_runs = (int*) alignedMalloc(size_evals_of_runs);
......@@ -386,7 +308,7 @@ filled with clock() */
// allocating memory in CPU for generation counters
cpu_gens_of_runs = (int*) alignedMalloc(size_evals_of_runs);
memset(cpu_gens_of_runs, 0, size_evals_of_runs);
#endif
#endif
//preparing the constant data fields for the GPU
// ----------------------------------------------------------------------
......@@ -395,11 +317,11 @@ filled with clock() */
// and return them <here> (<here> = where prepare_const_fields_for_gpu() is called),
// so we can send them to Kernels from <here>, instead of from calcenergy.cpp as originally.
// ----------------------------------------------------------------------
#if defined(SINGLE_COPY_POP_ENE)
#if defined(SINGLE_COPY_POP_ENE)
if (prepare_conststatic_fields_for_gpu(&myligand_reference, mypars, cpu_ref_ori_angles, &KerConstStatic) == 1)
#else
#else
if (prepare_conststatic_fields_for_gpu(&myligand_reference, mypars, &KerConstStatic) == 1)
#endif
#endif
return 1;
//preparing parameter struct
......@@ -416,7 +338,6 @@ filled with clock() */
dockpars.rotbondlist_length = ((unsigned int) NUM_OF_THREADS_PER_BLOCK*(myligand_reference.num_of_rotcyc));
dockpars.coeff_elec = ((float) mypars->coeffs.scaled_AD4_coeff_elec);
dockpars.coeff_desolv = ((float) mypars->coeffs.AD4_coeff_desolv);
// L30nardoSV added
dockpars.num_of_energy_evals = (unsigned int) mypars->num_of_energy_evals;
dockpars.num_of_generations = (unsigned int) mypars->num_of_generations;
......@@ -437,11 +358,6 @@ filled with clock() */
dockpars.qasp = mypars->qasp;
dockpars.smooth = mypars->smooth;
/*
// passed correctly
printf("%i %i\n", dockpars.num_of_intraE_contributors, myligand_reference.num_of_intraE_contributors);
*/
// these variables hold multiplications between kernel-constants
// better calculate them here and then pass them to Krnl_GA
const float two_absmaxdmov = 2.0 * dockpars.abs_max_dmov;
......@@ -465,49 +381,36 @@ printf("%i %i\n", dockpars.num_of_intraE_contributors, myligand_reference.num_of
//allocating GPU memory for populations, floatgrids,
//energies, evaluation counters and random number generator states
//#if defined (FIXED_POINT_INTERE)
#if 0
size_fixedpt64grids = (sizeof(fixedpt64)) * (mygrid->num_of_atypes+2) * (mygrid->size_xyz[0]) * (mygrid->size_xyz[1]) * (mygrid->size_xyz[2]);
#else
#if defined(SEPARATE_FGRID_INTERE)
size_floatgrids = sizeof(float) * mygrid->num_of_atypes * mygrid->size_xyz[0]*mygrid->size_xyz[1]* mygrid->size_xyz[2];
size_floatgrids2= sizeof(float) * mygrid->size_xyz[0] * mygrid->size_xyz[1] * mygrid->size_xyz[2];
size_floatgrids3= sizeof(float) * mygrid->size_xyz[0] * mygrid->size_xyz[1] * mygrid->size_xyz[2];
#else
size_floatgrids = (sizeof(float)) * (mygrid->num_of_atypes+2) * (mygrid->size_xyz[0]) * (mygrid->size_xyz[1]) * (mygrid->size_xyz[2]);
size_floatgrids = sizeof(float) * (mygrid->num_of_atypes+2) * (mygrid->size_xyz[0]) * (mygrid->size_xyz[1]) * (mygrid->size_xyz[2]);
#endif
#endif
#if defined (FIXED_POINT_INTERE)
#if defined (FIXED_POINT_INTERE)
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ATOMS*sizeof(fixedpt64), &mem_KerConstStatic_fixpt64_atom_charges_const);
#endif
#endif
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ATOMS*sizeof(float), &mem_KerConstStatic_atom_charges_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ATOMS*sizeof(char), &mem_KerConstStatic_atom_types_const);
/*
mallocBufferObject(context,CL_MEM_READ_ONLY, 3*MAX_INTRAE_CONTRIBUTORS*sizeof(char), &mem_KerConstStatic_intraE_contributors_const);
*/
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_INTRAE_CONTRIBUTORS*sizeof(cl_char3), &mem_KerConstStatic_intraE_contributors_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_INTRAE_CONTRIBUTORS*sizeof(cl_char3), &mem_KerConstStatic_intraE_contributors_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, ATYPE_NUM*sizeof(float), &mem_KerConstStatic_reqm_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, ATYPE_NUM*sizeof(float), &mem_KerConstStatic_reqm_hbond_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, ATYPE_NUM*sizeof(unsigned int), &mem_KerConstStatic_atom1_types_reqm_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, ATYPE_NUM*sizeof(unsigned int), &mem_KerConstStatic_atom2_types_reqm_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ATYPES*MAX_NUM_OF_ATYPES*sizeof(float), &mem_KerConstStatic_VWpars_AC_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ATYPES*MAX_NUM_OF_ATYPES*sizeof(float), &mem_KerConstStatic_VWpars_BD_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ATYPES*sizeof(float), &mem_KerConstStatic_dspars_S_const);
mallocBufferObject(context,CL_MEM_READ_ONLY, MAX_NUM_OF_ATYPES*sizeof(float), &mem_KerConstStatic_dspars_V_const);
#if defined (FIXED_POINT_CONFORM)
// fixed-point
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_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);
......@@ -515,37 +418,33 @@ printf("%i %i\n", dockpars.num_of_intraE_contributors, myligand_reference.num_of
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)
#if 0
mallocBufferObject(context,CL_MEM_READ_ONLY,size_fixedpt64grids, &mem_dockpars_fgrids);
#else
mallocBufferObject(context,CL_MEM_READ_ONLY,size_floatgrids, &mem_dockpars_fgrids);
#if defined(SEPARATE_FGRID_INTERE)
mallocBufferObject(context,CL_MEM_READ_ONLY,size_floatgrids2, &mem_dockpars_fgrids2);
mallocBufferObject(context,CL_MEM_READ_ONLY,size_floatgrids3, &mem_dockpars_fgrids3);
#endif
#endif
mallocBufferObject(context,CL_MEM_READ_WRITE,size_populations, &mem_dockpars_conformations_current);
mallocBufferObject(context,CL_MEM_READ_WRITE,size_energies, &mem_dockpars_energies_current);
#if defined(SINGLE_COPY_POP_ENE)
#if defined(SINGLE_COPY_POP_ENE)
mallocBufferObject(context,CL_MEM_WRITE_ONLY,size_evals_of_runs, &mem_evals_performed);
mallocBufferObject(context,CL_MEM_WRITE_ONLY,size_evals_of_runs, &mem_gens_performed);
#else
#else
mallocBufferObject(context,CL_MEM_WRITE_ONLY,2*sizeof(unsigned int), &mem_evals_and_generations_performed);
#endif
#endif
#if defined(SINGLE_COPY_POP_ENE)
#if defined(SINGLE_COPY_POP_ENE)
#else
#else
unsigned int array_evals_and_generations_performed [2]; // [0]: evals, [1]: generations
#endif
#endif
#if defined (FIXED_POINT_INTERE)
#if defined (FIXED_POINT_INTERE)
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_fixpt64_atom_charges_const, &KerConstStatic.fixpt64_atom_charges_const[0], MAX_NUM_OF_ATOMS*sizeof(fixedpt64));
#endif
#endif
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_atom_charges_const, &KerConstStatic.atom_charges_const[0], MAX_NUM_OF_ATOMS*sizeof(float));
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_atom_types_const, &KerConstStatic.atom_types_const[0], MAX_NUM_OF_ATOMS*sizeof(char));
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_intraE_contributors_const, &KerConstStatic.intraE_contributors_const[0], MAX_INTRAE_CONTRIBUTORS*sizeof(cl_char3));
......@@ -559,15 +458,14 @@ printf("%i %i\n", dockpars.num_of_intraE_contributors, myligand_reference.num_of
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_VWpars_BD_const, &KerConstStatic.VWpars_BD_const[0], MAX_NUM_OF_ATYPES*MAX_NUM_OF_ATYPES*sizeof(float));
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_dspars_S_const, &KerConstStatic.dspars_S_const[0], MAX_NUM_OF_ATYPES*sizeof(float));
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_dspars_V_const, &KerConstStatic.dspars_V_const[0], MAX_NUM_OF_ATYPES*sizeof(float));
#if defined (FIXED_POINT_CONFORM)
// fixed-point
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_rotlist_const, &KerConstStatic.rotlist_const[0], MAX_NUM_OF_ROTATIONS*sizeof(fixedpt));
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_ref_coords_const, &KerConstStatic.ref_coords_const[0], MAX_NUM_OF_ATOMS*sizeof(cl_int3));
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_rotbonds_moving_vectors_const, &KerConstStatic.rotbonds_moving_vectors_const[0], MAX_NUM_OF_ROTBONDS*sizeof(cl_int3));
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_rotbonds_unit_vectors_const, &KerConstStatic.rotbonds_unit_vectors_const[0], MAX_NUM_OF_ROTBONDS*sizeof(cl_int3));
memcopyBufferObjectToDevice(command_queue_ga,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_queue_ga,mem_KerConstStatic_rotlist_const, &KerConstStatic.rotlist_const[0], MAX_NUM_OF_ROTATIONS*sizeof(int));
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_ref_coords_const, &KerConstStatic.ref_coords_const[0], MAX_NUM_OF_ATOMS*sizeof(cl_float3));
memcopyBufferObjectToDevice(command_queue_ga,mem_KerConstStatic_rotbonds_moving_vectors_const, &KerConstStatic.rotbonds_moving_vectors_const[0], MAX_NUM_OF_ROTBONDS*sizeof(cl_float3));
......@@ -575,242 +473,198 @@ printf("%i %i\n", dockpars.num_of_intraE_contributors, myligand_reference.num_of
memcopyBufferObjectToDevice(command_queue_ga,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)
#if 0
/*
cpu_fixedpt64grids = (fixedpt64*) alignedMalloc((sizeof(fixedpt64))*(mygrid->num_of_atypes+2)*
(mygrid->size_xyz[0])*
(mygrid->size_xyz[1])*
(mygrid->size_xyz[2]));
*/
cpu_fixedpt64grids = (fixedpt64*) alignedMalloc(size_fixedpt64grids);
float* mypoi;
fixedpt64* myqoi;
mypoi = cpu_floatgrids;
myqoi = cpu_fixedpt64grids;
for (int t=0; t < mygrid->num_of_atypes+2; t++) {
//reading values
for (int z=0; z < mygrid->size_xyz[2]; z++)
for (int y=0; y < mygrid->size_xyz[1]; y++)
for (int x=0; x < mygrid->size_xyz[0]; x++)
{
//fscanf(fp, "%f", mypoi);
//mypoi++;
float tmp_grids = *mypoi;
mypoi++;
*myqoi = fixedpt64_fromfloat(tmp_grids);
// test to prove that it requires 32.32
// and 16.16 is not enough
//fixedpt myqoi16 = fixedpt_fromfloat(tmp_grids);
//printf("%-10f %-10f %-10f\n", tmp_grids, fixedpt64_tofloat(*myqoi), fixedpt_tofloat(myqoi16));
myqoi++;
}
}
memcopyBufferObjectToDevice(command_queue1,mem_dockpars_fgrids, cpu_fixedpt64grids, size_fixedpt64grids);
#else
memcopyBufferObjectToDevice(command_queue_ga,mem_dockpars_fgrids, cpu_floatgrids, size_floatgrids);
#if defined(SEPARATE_FGRID_INTERE)
memcopyBufferObjectToDevice(command_queue_ga,mem_dockpars_fgrids2, cpu_floatgrids + mygrid->num_of_atypes * mygrid->size_xyz[0]*mygrid->size_xyz[1]* mygrid->size_xyz[2], size_floatgrids2);
memcopyBufferObjectToDevice(command_queue_ga,mem_dockpars_fgrids3, cpu_floatgrids + (mygrid->num_of_atypes+1) * mygrid->size_xyz[0]*mygrid->size_xyz[1]* mygrid->size_xyz[2], size_floatgrids3);
#endif
#endif
clock_start_docking = clock();
#ifdef ENABLE_KRNL_GA
#ifdef ENABLE_KRNL_GA
#if defined(SINGLE_COPY_POP_ENE)
setKernelArg(kernel_ga,0, sizeof(mem_dockpars_conformations_current), &mem_dockpars_conformations_current);
setKernelArg(kernel_ga,1, sizeof(mem_dockpars_energies_current), &mem_dockpars_energies_current);
setKernelArg(kernel_ga,2, sizeof(mem_evals_performed), &mem_evals_performed);
setKernelArg(kernel_ga,3, sizeof(mem_gens_performed), &mem_gens_performed);
setKernelArg(kernel_ga,4, sizeof(unsigned int), &dockpars.pop_size);
setKernelArg(kernel_ga,5, sizeof(unsigned int), &dockpars.num_of_energy_evals);
setKernelArg(kernel_ga,6, sizeof(unsigned int), &dockpars.num_of_generations);
setKernelArg(kernel_ga,7, sizeof(float), &dockpars.tournament_rate);
setKernelArg(kernel_ga,8, sizeof(float), &dockpars.mutation_rate);
setKernelArg(kernel_ga,9, sizeof(float), &dockpars.abs_max_dmov);
setKernelArg(kernel_ga,10, sizeof(float), &dockpars.abs_max_dang);
setKernelArg(kernel_ga,11, sizeof(float), &two_absmaxdmov);
setKernelArg(kernel_ga,12, sizeof(float), &two_absmaxdang);
setKernelArg(kernel_ga,13, sizeof(float), &dockpars.crossover_rate);
setKernelArg(kernel_ga,14, sizeof(unsigned int), &dockpars.num_of_lsentities);
setKernelArg(kernel_ga,15, sizeof(unsigned char), &dockpars.num_of_genes);
setKernelArg(kernel_ga,0, sizeof(cl_mem), &mem_dockpars_conformations_current);
setKernelArg(kernel_ga,1, sizeof(cl_mem), &mem_dockpars_energies_current);
setKernelArg(kernel_ga,2, sizeof(cl_mem), &mem_evals_performed);
setKernelArg(kernel_ga,3, sizeof(cl_mem), &mem_gens_performed);
setKernelArg(kernel_ga,4, sizeof(unsigned int), &dockpars.pop_size);
setKernelArg(kernel_ga,5, sizeof(unsigned int), &dockpars.num_of_energy_evals);
setKernelArg(kernel_ga,6, sizeof(unsigned int), &dockpars.num_of_generations);
setKernelArg(kernel_ga,7, sizeof(float), &dockpars.tournament_rate);
setKernelArg(kernel_ga,8, sizeof(float), &dockpars.mutation_rate);
setKernelArg(kernel_ga,9, sizeof(float), &dockpars.abs_max_dmov);
setKernelArg(kernel_ga,10, sizeof(float), &dockpars.abs_max_dang);
setKernelArg(kernel_ga,11, sizeof(float), &two_absmaxdmov);
setKernelArg(kernel_ga,12, sizeof(float), &two_absmaxdang);
setKernelArg(kernel_ga,13, sizeof(float), &dockpars.crossover_rate);
setKernelArg(kernel_ga,14, sizeof(unsigned int), &dockpars.num_of_lsentities);
setKernelArg(kernel_ga,15, sizeof(unsigned char), &dockpars.num_of_genes);
#else
setKernelArg(kernel_ga,0, sizeof(mem_dockpars_conformations_current), &mem_dockpars_conformations_current);
setKernelArg(kernel_ga,1, sizeof(mem_dockpars_energies_current), &mem_dockpars_energies_current);
setKernelArg(kernel_ga,2, sizeof(mem_evals_and_generations_performed), &mem_evals_and_generations_performed);
setKernelArg(kernel_ga,3, sizeof(unsigned int), &dockpars.pop_size);
setKernelArg(kernel_ga,4, sizeof(unsigned int), &dockpars.num_of_energy_evals);
setKernelArg(kernel_ga,5, sizeof(unsigned int), &dockpars.num_of_generations);
setKernelArg(kernel_ga,6, sizeof(float), &dockpars.tournament_rate);
setKernelArg(kernel_ga,7, sizeof(float), &dockpars.mutation_rate);
setKernelArg(kernel_ga,8, sizeof(float), &dockpars.abs_max_dmov);
setKernelArg(kernel_ga,9, sizeof(float), &dockpars.abs_max_dang);
setKernelArg(kernel_ga,10, sizeof(float), &two_absmaxdmov);
setKernelArg(kernel_ga,11, sizeof(float), &two_absmaxdang);
setKernelArg(kernel_ga,12, sizeof(float), &dockpars.crossover_rate);
setKernelArg(kernel_ga,13, sizeof(unsigned int), &dockpars.num_of_lsentities);
setKernelArg(kernel_ga,14, sizeof(unsigned char), &dockpars.num_of_genes);
setKernelArg(kernel_ga,0, sizeof(cl_mem), &mem_dockpars_conformations_current);
setKernelArg(kernel_ga,1, sizeof(cl_mem), &mem_dockpars_energies_current);
setKernelArg(kernel_ga,2, sizeof(cl_mem), &mem_evals_and_generations_performed);
setKernelArg(kernel_ga,3, sizeof(unsigned int), &dockpars.pop_size);
setKernelArg(kernel_ga,4, sizeof(unsigned int), &dockpars.num_of_energy_evals);
setKernelArg(kernel_ga,5, sizeof(unsigned int), &dockpars.num_of_generations);
setKernelArg(kernel_ga,6, sizeof(float), &dockpars.tournament_rate);
setKernelArg(kernel_ga,7, sizeof(float), &dockpars.mutation_rate);
setKernelArg(kernel_ga,8, sizeof(float), &dockpars.abs_max_dmov);
setKernelArg(kernel_ga,9, sizeof(float), &dockpars.abs_max_dang);
setKernelArg(kernel_ga,10, sizeof(float), &two_absmaxdmov);
setKernelArg(kernel_ga,11, sizeof(float), &two_absmaxdang);
setKernelArg(kernel_ga,12, sizeof(float), &dockpars.crossover_rate);
setKernelArg(kernel_ga,13, sizeof(unsigned int), &dockpars.num_of_lsentities);
setKernelArg(kernel_ga,14, sizeof(unsigned char), &dockpars.num_of_genes);
#endif
#endif
#endif
#ifdef ENABLE_KRNL_CONFORM
setKernelArg(kernel_conform,0, sizeof(mem_KerConstStatic_rotlist_const), &mem_KerConstStatic_rotlist_const);
setKernelArg(kernel_conform,1, sizeof(mem_KerConstStatic_ref_coords_const), &mem_KerConstStatic_ref_coords_const);
setKernelArg(kernel_conform,2, sizeof(mem_KerConstStatic_rotbonds_moving_vectors_const), &mem_KerConstStatic_rotbonds_moving_vectors_const);
setKernelArg(kernel_conform,3, sizeof(mem_KerConstStatic_rotbonds_unit_vectors_const), &mem_KerConstStatic_rotbonds_unit_vectors_const);
setKernelArg(kernel_conform,4, sizeof(unsigned int), &dockpars.rotbondlist_length);
setKernelArg(kernel_conform,5, sizeof(unsigned char), &dockpars.num_of_atoms);
setKernelArg(kernel_conform,6, sizeof(unsigned char), &dockpars.num_of_genes);
setKernelArg(kernel_conform,7, sizeof(mem_KerConstStatic_ref_orientation_quats_const), &mem_KerConstStatic_ref_orientation_quats_const);
#ifdef ENABLE_KRNL_CONFORM
setKernelArg(kernel_conform,0, sizeof(cl_mem), &mem_KerConstStatic_rotlist_const);
setKernelArg(kernel_conform,1, sizeof(cl_mem), &mem_KerConstStatic_ref_coords_const);
setKernelArg(kernel_conform,2, sizeof(cl_mem), &mem_KerConstStatic_rotbonds_moving_vectors_const);
setKernelArg(kernel_conform,3, sizeof(cl_mem), &mem_KerConstStatic_rotbonds_unit_vectors_const);
setKernelArg(kernel_conform,4, sizeof(unsigned int), &dockpars.rotbondlist_length);
setKernelArg(kernel_conform,5, sizeof(unsigned char), &dockpars.num_of_atoms);
setKernelArg(kernel_conform,6, sizeof(unsigned char), &dockpars.num_of_genes);
setKernelArg(kernel_conform,7, sizeof(cl_mem), &mem_KerConstStatic_ref_orientation_quats_const);
#if defined(SINGLE_COPY_POP_ENE)
#else
#if defined (FIXED_POINT_CONFORM)
// fixed-point
setKernelArg(kernel_conform,8, sizeof(fixedpt), &KerConstDynamic.ref_orientation_quats_const[0]);
setKernelArg(kernel_conform,9, sizeof(fixedpt), &KerConstDynamic.ref_orientation_quats_const[1]);
setKernelArg(kernel_conform,10, sizeof(fixedpt), &KerConstDynamic.ref_orientation_quats_const[2]);
setKernelArg(kernel_conform,11, sizeof(fixedpt), &KerConstDynamic.ref_orientation_quats_const[3]);
#else
// floating-point (original)
setKernelArg(kernel_conform,8, sizeof(float), &KerConstDynamic.ref_orientation_quats_const[0]);
setKernelArg(kernel_conform,9, sizeof(float), &KerConstDynamic.ref_orientation_quats_const[1]);
setKernelArg(kernel_conform,10, sizeof(float), &KerConstDynamic.ref_orientation_quats_const[2]);
setKernelArg(kernel_conform,11, sizeof(float), &KerConstDynamic.ref_orientation_quats_const[3]);
#endif
#endif
#endif
#endif
unsigned char gridsizex_minus1 = dockpars.gridsize_x - 1;
unsigned char gridsizey_minus1 = dockpars.gridsize_y - 1;
unsigned char gridsizez_minus1 = dockpars.gridsize_z - 1;
#if defined (FIXED_POINT_INTERE)
#if defined (FIXED_POINT_INTERE)
#else
#else
float fgridsizex_minus1 = (float) gridsizex_minus1;
float fgridsizey_minus1 = (float) gridsizey_minus1;
float fgridsizez_minus1 = (float) gridsizez_minus1;
#endif
#endif
#ifdef ENABLE_KRNL_INTERE
#ifdef ENABLE_KRNL_INTERE
setKernelArg(kernel_intere,0, sizeof(mem_dockpars_fgrids), &mem_dockpars_fgrids);
setKernelArg(kernel_intere,0, sizeof(cl_mem), &mem_dockpars_fgrids);
#if defined (FIXED_POINT_INTERE)
setKernelArg(kernel_intere,1, sizeof(mem_KerConstStatic_fixpt64_atom_charges_const), &mem_KerConstStatic_fixpt64_atom_charges_const);
setKernelArg(kernel_intere,1, sizeof(cl_mem), &mem_KerConstStatic_fixpt64_atom_charges_const);
#else
setKernelArg(kernel_intere,1, sizeof(mem_KerConstStatic_atom_charges_const), &mem_KerConstStatic_atom_charges_const);
setKernelArg(kernel_intere,1, sizeof(cl_mem), &mem_KerConstStatic_atom_charges_const);
#endif
setKernelArg(kernel_intere,2, sizeof(mem_KerConstStatic_atom_types_const), &mem_KerConstStatic_atom_types_const);
setKernelArg(kernel_intere,3, sizeof(unsigned char), &dockpars.g1);
setKernelArg(kernel_intere,4, sizeof(unsigned int), &dockpars.g2);
setKernelArg(kernel_intere,5, sizeof(unsigned int), &dockpars.g3);
setKernelArg(kernel_intere,6, sizeof(unsigned char), &dockpars.num_of_atoms);
setKernelArg(kernel_intere,2, sizeof(cl_mem), &mem_KerConstStatic_atom_types_const);
setKernelArg(kernel_intere,3, sizeof(unsigned char), &dockpars.g1);
setKernelArg(kernel_intere,4, sizeof(unsigned int), &dockpars.g2);
setKernelArg(kernel_intere,5, sizeof(unsigned int), &dockpars.g3);
setKernelArg(kernel_intere,6, sizeof(unsigned char), &dockpars.num_of_atoms);
#if defined (FIXED_POINT_INTERE)
setKernelArg(kernel_intere,7, sizeof(unsigned char), &gridsizex_minus1);
setKernelArg(kernel_intere,8, sizeof(unsigned char), &gridsizey_minus1);
setKernelArg(kernel_intere,9, sizeof(unsigned char), &gridsizez_minus1);
setKernelArg(kernel_intere,7, sizeof(unsigned char), &gridsizex_minus1);
setKernelArg(kernel_intere,8, sizeof(unsigned char), &gridsizey_minus1);
setKernelArg(kernel_intere,9, sizeof(unsigned char), &gridsizez_minus1);
#else
setKernelArg(kernel_intere,7, sizeof(float), &fgridsizex_minus1);
setKernelArg(kernel_intere,8, sizeof(float), &fgridsizey_minus1);
setKernelArg(kernel_intere,9, sizeof(float), &fgridsizez_minus1);
setKernelArg(kernel_intere,7, sizeof(float), &fgridsizex_minus1);
setKernelArg(kernel_intere,8, sizeof(float), &fgridsizey_minus1);
setKernelArg(kernel_intere,9, sizeof(float), &fgridsizez_minus1);
#endif
#if defined(SEPARATE_FGRID_INTERE)
setKernelArg(kernel_intere,10, sizeof(mem_dockpars_fgrids2), &mem_dockpars_fgrids2);
setKernelArg(kernel_intere,11, sizeof(mem_dockpars_fgrids3), &mem_dockpars_fgrids3);
setKernelArg(kernel_intere,10, sizeof(cl_mem), &mem_dockpars_fgrids2);
setKernelArg(kernel_intere,11, sizeof(cl_mem), &mem_dockpars_fgrids3);
#else
setKernelArg(kernel_intere,10, sizeof(unsigned int), &mul_tmp2);
setKernelArg(kernel_intere,11, sizeof(unsigned int), &mul_tmp3);
setKernelArg(kernel_intere,10, sizeof(unsigned int), &mul_tmp2);
setKernelArg(kernel_intere,11, sizeof(unsigned int), &mul_tmp3);
#endif
#endif
#ifdef ENABLE_KRNL_INTRAE
setKernelArg(kernel_intrae,0, sizeof(mem_KerConstStatic_atom_charges_const), &mem_KerConstStatic_atom_charges_const);
setKernelArg(kernel_intrae,1, sizeof(mem_KerConstStatic_atom_types_const), &mem_KerConstStatic_atom_types_const);
setKernelArg(kernel_intrae,2, sizeof(mem_KerConstStatic_intraE_contributors_const), &mem_KerConstStatic_intraE_contributors_const);
setKernelArg(kernel_intrae,3, sizeof(dockpars.smooth), &dockpars.smooth);
setKernelArg(kernel_intrae,4, sizeof(mem_KerConstStatic_reqm_const), &mem_KerConstStatic_reqm_const);
setKernelArg(kernel_intrae,5, sizeof(mem_KerConstStatic_reqm_hbond_const), &mem_KerConstStatic_reqm_hbond_const);
setKernelArg(kernel_intrae,6, sizeof(mem_KerConstStatic_atom1_types_reqm_const), &mem_KerConstStatic_atom1_types_reqm_const);
setKernelArg(kernel_intrae,7, sizeof(mem_KerConstStatic_atom2_types_reqm_const), &mem_KerConstStatic_atom2_types_reqm_const);
setKernelArg(kernel_intrae,8, sizeof(mem_KerConstStatic_VWpars_AC_const), &mem_KerConstStatic_VWpars_AC_const);
setKernelArg(kernel_intrae,9, sizeof(mem_KerConstStatic_VWpars_BD_const), &mem_KerConstStatic_VWpars_BD_const);
setKernelArg(kernel_intrae,10, sizeof(mem_KerConstStatic_dspars_S_const), &mem_KerConstStatic_dspars_S_const);
setKernelArg(kernel_intrae,11, sizeof(mem_KerConstStatic_dspars_V_const), &mem_KerConstStatic_dspars_V_const);
setKernelArg(kernel_intrae,12, sizeof(unsigned char), &dockpars.num_of_atoms);
setKernelArg(kernel_intrae,13, sizeof(unsigned int), &dockpars.num_of_intraE_contributors);
setKernelArg(kernel_intrae,14, sizeof(float), &dockpars.grid_spacing);