Commit 9c153df7 authored by Leonardo Solis's avatar Leonardo Solis

LS9 blocks + added comments + corrections

parent 3938e557
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// --------------------------------------------------------------------------
// IGL_Arbiter keeps checking whether any kernel (GA or any LSs)
// is sending genotypes to Conform, as well as whether
// GA sent the "turn-off" signal.
// Its name references the logic that is producing genotypes:
// IC, GG and any LS.
// IC and GG are two logic blocks inside the GA kernel,
// while any LS logic is a kernel itself.
// It uses the valid signals to determine the "mode" value,
// used as a mux selector signal (of genotype logic-producers) in Conform.
// Initially genotypes passed through this kernel getting reordered and
// synchronized with "mode".
// This has been later optimized, so now genotypes go directly
// from producer logic/kernel (IC, GG, LSs) to the consumer (Conform) kernel.
// --------------------------------------------------------------------------
__kernel __attribute__ ((max_global_work_dim(0)))
void Krnl_IGL_Arbiter(/*unsigned char DockConst_num_of_genes*/) {
......@@ -71,12 +86,11 @@ while(active) {
active = Off_valid ? 0x00 : 0x01;
char mode [9]; // mode for all LS
/*
float genotypeICGG [ACTUAL_GENOTYPE_LENGTH];
float genotype [3][ACTUAL_GENOTYPE_LENGTH];
*/
// get genotype from IC, GG, LS1, LS2, LS3
// Determine "mode" value
// This considers all possible cases as all LS could be
// potentially producing genotypes simultaneously.
// Be careful modifying the nested conditional-statements below,
// as even a litle mistake may be undetectable in emulation.
if (active == 0x01) {
if (IC_valid == true) {
......@@ -86,7 +100,7 @@ while(active) {
bound_tmp++;
}
else{
// Reorder the mode & genotype coming from LS
// Reorder the mode & from LS
// **************************************************************************************
// LS1: yes
......@@ -1292,45 +1306,20 @@ while(active) {
uchar bound = active ? bound_tmp : 1;
/*
if ((LS1_end_valid || LS2_end_valid || LS3_end_valid)) {
printf("bound_tmp: %-5u, LS1: %-5s, LS2: %-5s, LS3: %-5s\n", bound_tmp, LS1_end_valid?"yes":"no", LS2_end_valid?"yes":"no", LS3_end_valid?"yes":"no");
}
*/
// send data to Krnl_Conform
// Send "mode" to Conform
for (uchar j=0; j<bound; j++) {
char mode_tmp = Off_valid? 0x00: IC_valid? 'I': GG_valid? 'G': mode[j];
//printf("IGL: %u\n", mode_tmp);
char2 actmode = {active, mode_tmp};
write_channel_altera(chan_IGL2Conform_actmode, actmode);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
/*
for (uchar i=0; i<DockConst_num_of_genes; i++) {
float gene_tmp = (IC_valid || GG_valid)? genotypeICGG[i]: genotype[j][i & MASK_GENOTYPE];
if (i > 2) {
gene_tmp = gene_tmp * DEG_TO_RAD;
}
write_channel_altera(chan_IGL2Conform_genotype, gene_tmp);
}
*/
#if defined (DEBUG_KRNL_CONF_ARBITER)
#if defined (DEBUG_KRNL_IGL_ARBITER)
printf("bound: %u, mode: %u\n", bound, mode_tmp);
#endif
}
// Only for debugging
/*
// Only for debugging
/*
if (LS1_end_active == true) {
LS1_eval = 0;
}
......@@ -1342,9 +1331,8 @@ while(active) {
if (LS3_end_active == true) {
LS3_eval = 0;
}
*/
*/
} // End of while (active)
}
......
// --------------------------------------------------------------------------
// The function calculates the intermolecular energy of a ligand given by
// myligand parameter, and a receptor represented as a grid.
// The grid point values must be stored at the location which starts at GlobFgrids,
// the memory content can be generated with get_gridvalues function.
// The mygrid parameter must be the corresponding grid informtaion.
// If an atom is outside the grid, the coordinates will be changed with
// the value of outofgrid_tolerance,
// if it remains outside, a very high value will be added to the current energy as a penalty.
// InterE calculates the intermolecular energy of a ligand given by
// ligand xyz-positions, and a receptor represented as a grid.
// The grid point values must be stored at the location which starts at GlobFgrids.
// If an atom is remains outside the grid,
// a very high value will be added to the current energy as a penalty.
// Originally from: processligand.c
// --------------------------------------------------------------------------
__kernel __attribute__ ((max_global_work_dim(0)))
......@@ -47,9 +44,6 @@ void Krnl_InterE(
*/
)
{
/*
bool active = true;
*/
char active = 0x01;
__global const float* GlobFgrids2 = & GlobFgrids [Host_mul_tmp2];
......@@ -80,12 +74,6 @@ while(active) {
active = actmode.x;
mode = actmode.y;
/*
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt++) {
loc_coords[pipe_cnt] = read_channel_altera(chan_Conf2Intere_xyz);
}
*/
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt+=2) {
float8 tmp = read_channel_altera(chan_Conf2Intere_xyz);
float3 tmp1 = {tmp.s0, tmp.s1, tmp.s2};
......@@ -94,7 +82,6 @@ while(active) {
loc_coords[pipe_cnt+1] = tmp2;
}
// --------------------------------------------------------------
//printf("AFTER In INTER CHANNEL\n");
......@@ -108,7 +95,7 @@ while(active) {
float interE = 0.0f;
#endif
// for each atom
// For each ligand atom
for (uchar atom1_id=0; atom1_id<DockConst_num_of_atoms; atom1_id++)
{
char atom1_typeid = KerConstStatic_atom_types_const [atom1_id];
......@@ -119,11 +106,11 @@ while(active) {
float y = loc_coords_atid1.y;
float z = loc_coords_atid1.z;
#if defined (FIXED_POINT_INTERE)
#if defined (FIXED_POINT_INTERE)
#else
#else
float q = KerConstStatic_atom_charges_const [atom1_id];
#endif
#endif
#if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_x = fixedpt64_fromfloat(loc_coords_atid1.x);
......@@ -143,7 +130,7 @@ while(active) {
float partialE3;
#endif
// if the atom is outside of the grid
// If the atom is outside of the grid
#if defined (FIXED_POINT_INTERE)
if ((fixpt_x < 0) || (fixpt_x >= fixedpt64_fromint(DockConst_gridsize_x_minus1)) ||
(fixpt_y < 0) || (fixpt_y >= fixedpt64_fromint(DockConst_gridsize_y_minus1)) ||
......@@ -154,7 +141,7 @@ while(active) {
(z < 0.0f) || (z >= DockConst_gridsize_z_minus1)) {
#endif
//penalty is 2^24 for each atom outside the grid
// Penalty is 2^24 for each atom outside the grid
/*
interE += 16777216.0f;
*/
......@@ -235,7 +222,7 @@ while(active) {
printf("coeff(1,1,1) = %f\n", weights [1][1][1]);
#endif
// lvs added temporal variables
// Added temporal variables
uint cube_000, cube_100, cube_010, cube_110, cube_001, cube_101, cube_011, cube_111;
uint ylow_times_g1 = y_low * DockConst_g1;
......@@ -254,7 +241,7 @@ while(active) {
uint mul_tmp = atom1_typeid * DockConst_g3;
//energy contribution of the current grid type
// Energy contribution of the current grid type
#if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_cube [2][2][2];
fixpt_cube [0][0][0] = fixedpt64_fromfloat(GlobFgrids[cube_000 + mul_tmp]);
......@@ -314,7 +301,7 @@ while(active) {
printf("interpolated value = %f\n\n", TRILININTERPOL(cube, weights));
#endif
//energy contribution of the electrostatic grid
// Energy contribution of the electrostatic grid
/*
#if defined(SEPARATE_FGRID_INTERE)
#else
......@@ -383,7 +370,7 @@ while(active) {
printf("interpolated value = %f, multiplied by q = %f\n\n", TRILININTERPOL(cube, weights), q*TRILININTERPOL(cube, weights));
#endif
//energy contribution of the desolvation grid
// Energy contribution of the desolvation grid
/*
#if defined(SEPARATE_FGRID_INTERE)
#else
......@@ -471,42 +458,21 @@ while(active) {
#endif
switch (mode) {
// IC
case 'I': write_channel_altera(chan_Intere2StoreIC_intere, final_interE); break;
// GG
case 'G': write_channel_altera(chan_Intere2StoreGG_intere, final_interE); break;
// LS 1
case 'I': write_channel_altera(chan_Intere2StoreIC_intere, final_interE); break;
case 'G': write_channel_altera(chan_Intere2StoreGG_intere, final_interE); break;
case 0x01: write_channel_altera(chan_Intere2StoreLS_LS1_intere, final_interE); break;
// LS 2
case 0x02: write_channel_altera(chan_Intere2StoreLS_LS2_intere, final_interE); break;
// LS 3
case 0x03: write_channel_altera(chan_Intere2StoreLS_LS3_intere, final_interE); break;
// LS 4
case 0x04: write_channel_altera(chan_Intere2StoreLS_LS4_intere, final_interE); break;
// LS 5
case 0x05: write_channel_altera(chan_Intere2StoreLS_LS5_intere, final_interE); break;
// LS 6
case 0x06: write_channel_altera(chan_Intere2StoreLS_LS6_intere, final_interE); break;
// LS 7
case 0x07: write_channel_altera(chan_Intere2StoreLS_LS7_intere, final_interE); break;
// LS 8
case 0x08: write_channel_altera(chan_Intere2StoreLS_LS8_intere, final_interE); break;
// LS 9
case 0x09: write_channel_altera(chan_Intere2StoreLS_LS9_intere, final_interE); break;
}
// --------------------------------------------------------------
} // End of while(1)
} // End of while(active)
#if defined (DEBUG_ACTIVE_KERNEL)
printf(" %-20s: %s\n", "Krnl_InterE", "disabled");
......
......@@ -4,10 +4,12 @@ float sqrt_custom(const float x)
uint i = *(uint*) &x;
i += 127 << 23; // adjust bias
i >>= 1; // approximation of square root
return as_float(i); //return *(float*) &i;
return as_float(i); // return *(float*) &i;
}
// --------------------------------------------------------------------------
// IntraE calculates the intramolecular energy of a set of atomic ligand
// contributor-pairs.
// Originally from: processligand.c
// --------------------------------------------------------------------------
__kernel __attribute__ ((max_global_work_dim(0)))
......@@ -28,15 +30,8 @@ void Krnl_IntraE(
float DockConst_coeff_elec,
float DockConst_qasp,
float DockConst_coeff_desolv
/*
,
unsigned int Host_square_num_of_atypes
*/
)
{
/*
bool active = true;
*/
char active = 0x01;
__local char3 intraE_contributors_localcache [MAX_INTRAE_CONTRIBUTORS];
......@@ -68,12 +63,6 @@ while(active) {
active = actmode.x;
mode = actmode.y;
/*
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt++) {
loc_coords[pipe_cnt] = read_channel_altera(chan_Conf2Intrae_xyz);
}
*/
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt+=2) {
float8 tmp = read_channel_altera(chan_Conf2Intrae_xyz);
float3 tmp1 = {tmp.s0, tmp.s1, tmp.s2};
......@@ -92,9 +81,9 @@ while(active) {
float intraE = 0.0f;
#if defined (FIXED_POINT_INTRAE)
// create shift register to reduce II (initially II=32, unroll-factor=8)
// use fixedpt64 to reduce II=4 (after shift-register) downto II=1
#if defined (FIXED_POINT_INTRAE)
// Create shift register to reduce II (initially II=32, unroll-factor=8)
// Use fixedpt64 to reduce II=4 (after shift-register) downto II=1
//float shift_intraE[33];
fixedpt64 shift_intraE[33];
......@@ -104,9 +93,9 @@ while(active) {
shift_intraE[i] = 0;
}
#endif
#endif
//for each intramolecular atom contributor pair
// For each intramolecular atom contributor pair
//#pragma unroll 10
for (ushort contributor_counter=0; contributor_counter<DockConst_num_of_intraE_contributors; contributor_counter++) {
......@@ -130,7 +119,7 @@ while(active) {
#if defined (DEBUG_KRNL_INTRAE)
printf("\n\nToo low distance (%f) between atoms %u and %u\n", distance_leo, atom1_id, atom2_id);
#endif
//return HIGHEST_ENERGY; //returning maximal value
//return HIGHEST_ENERGY; // Returning maximal value
distance_leo = 1.0f;
}
......@@ -144,7 +133,7 @@ while(active) {
float partialE3;
float partialE4;
//but only if the distance is less than distance cutoff value and 20.48A (because of the tables)
// But only if the distance is less than distance cutoff value and 20.48A (because of the tables)
//if ((distance_leo < 8.0f) && (distance_leo < 20.48f))
if (distance_leo < 8.0f)
{
......@@ -158,20 +147,20 @@ while(active) {
char atom1_typeid = KerConstStatic_atom_types_const [atom1_id];
char atom2_typeid = KerConstStatic_atom_types_const [atom2_id];
//calculating van der Waals / hydrogen bond term
// Calculating van der Waals / hydrogen bond term
partialE1 = KerConstStatic_VWpars_AC_const [atom1_typeid*DockConst_num_of_atypes+atom2_typeid]*inverse_distance_pow_12;
float tmp_pE2 = KerConstStatic_VWpars_BD_const [atom1_typeid*DockConst_num_of_atypes+atom2_typeid];
if (ref_intraE_contributors_const.z == 1) //H-bond
if (ref_intraE_contributors_const.z == 1) // H-bond
partialE2 = tmp_pE2 * inverse_distance_pow_10;
else //van der Waals
else // Van der Waals
partialE2 = tmp_pE2 * inverse_distance_pow_6;
//calculating electrostatic term
// Calculating electrostatic term
partialE3 = native_divide( (DockConst_coeff_elec*KerConstStatic_atom_charges_const[atom1_id]*KerConstStatic_atom_charges_const[atom2_id]) , (distance_leo*(-8.5525f + native_divide(86.9525f, (1.0f + 7.7839f*native_exp(-0.3154f*distance_leo))))) );
//calculating desolvation term
// Calculating desolvation term
partialE4 = (
(KerConstStatic_dspars_S_const [atom1_typeid] + DockConst_qasp*fabs(KerConstStatic_atom_charges_const[atom1_id])) * KerConstStatic_dspars_V_const [atom2_typeid] +
(KerConstStatic_dspars_S_const [atom2_typeid] + DockConst_qasp*fabs(KerConstStatic_atom_charges_const[atom2_id])) * KerConstStatic_dspars_V_const [atom1_typeid]) *
......@@ -179,7 +168,7 @@ while(active) {
} // End of if: if ((dist < dcutoff) && (dist < 20.48))
#if defined (FIXED_POINT_INTRAE)
#if defined (FIXED_POINT_INTRAE)
//shift_intraE[32] = shift_intraE[0] + partialE1 + partialE2 + partialE3 + partialE4;
shift_intraE[32] = shift_intraE[0] + fixedpt64_fromfloat(partialE1) +
fixedpt64_fromfloat(partialE2) +
......@@ -190,13 +179,13 @@ while(active) {
for (uchar j=0; j<32; j++) {
shift_intraE[j] = shift_intraE[j+1];
}
#else
#else
intraE += partialE1 + partialE2 + partialE3 + partialE4;
#endif
#endif
} // End of contributor_counter for-loop
#if defined (FIXED_POINT_INTRAE)
#if defined (FIXED_POINT_INTRAE)
fixedpt64 fixpt_intraE = 0;
#pragma unroll
......@@ -205,48 +194,27 @@ while(active) {
fixpt_intraE += shift_intraE[j];
}
intraE = fixedpt64_tofloat(fixpt_intraE);
#endif
#endif
// --------------------------------------------------------------
// Send intramolecular energy to channel
// --------------------------------------------------------------
switch (mode) {
// IC
case 'I': write_channel_altera(chan_Intrae2StoreIC_intrae, intraE); break;
// GG
case 'G': write_channel_altera(chan_Intrae2StoreGG_intrae, intraE); break;
// LS 1
case 'I': write_channel_altera(chan_Intrae2StoreIC_intrae, intraE); break;
case 'G': write_channel_altera(chan_Intrae2StoreGG_intrae, intraE); break;
case 0x01: write_channel_altera(chan_Intrae2StoreLS_LS1_intrae, intraE); break;
// LS 2
case 0x02: write_channel_altera(chan_Intrae2StoreLS_LS2_intrae, intraE); break;
// LS 3
case 0x03: write_channel_altera(chan_Intrae2StoreLS_LS3_intrae, intraE); break;
// LS 4
case 0x04: write_channel_altera(chan_Intrae2StoreLS_LS4_intrae, intraE); break;
// LS 5
case 0x05: write_channel_altera(chan_Intrae2StoreLS_LS5_intrae, intraE); break;
// LS 6
case 0x06: write_channel_altera(chan_Intrae2StoreLS_LS6_intrae, intraE); break;
// LS 7
case 0x07: write_channel_altera(chan_Intrae2StoreLS_LS7_intrae, intraE); break;
// LS 8
case 0x08: write_channel_altera(chan_Intrae2StoreLS_LS8_intrae, intraE); break;
// LS 9
case 0x09: write_channel_altera(chan_Intrae2StoreLS_LS9_intrae, intraE); break;
}
// --------------------------------------------------------------
} // End of while(1)
} // End of while(active)
#if defined (DEBUG_ACTIVE_KERNEL)
printf(" %-20s: %s\n", "Krnl_IntraE", "disabled");
......
......@@ -22,32 +22,6 @@ void Krnl_LS(
)
{
bool valid = true;
/*
// added to find out which fixed-point precision is needed
// 16.16 is enough
fixedpt fp1 = fixedpt_fromfloat(DockConst_rho_lower_bound);
fixedpt fp2 = fixedpt_fromfloat(DockConst_base_dmov_mul_sqrt3);
fixedpt fp3 = fixedpt_fromfloat(DockConst_base_dang_mul_sqrt3);
printf("DockConst_rho_lower_bound: %f %f\n", DockConst_rho_lower_bound, fixedpt_tofloat(fp1));
printf("DockConst_base_dmov_mul_sqrt3: %f %f\n", DockConst_base_dmov_mul_sqrt3, fixedpt_tofloat(fp2));
printf("DockConst_base_dang_mul_sqrt3: %f %f\n", DockConst_base_dang_mul_sqrt3, fixedpt_tofloat(fp3));
*/
/*
// print fixedpt representation of 180.0f and 360.0f
printf("180f: %f %i %x\n", 180.0f, fixedpt_fromfloat(180.0f), fixedpt_fromfloat(180.0f));
printf("360f: %f %i %x\n", 360.0f, fixedpt_fromfloat(360.0f), fixedpt_fromfloat(360.0f));
// 180f: 180.000000 11796480 b40000
// 360f: 360.000000 23592960 1680000
*/
/*
// print fixedpt representation of 0.4f and 0.6f
printf("0.4f: %f %i %x\n", 0.4f, fixedpt_fromfloat(0.4f), fixedpt_fromfloat(0.4f));
printf("0.6f: %f %i %x\n", 0.6f, fixedpt_fromfloat(0.6f), fixedpt_fromfloat(0.6f));
//0.4f: 0.400000 26214 6666
//0.6f: 0.600000 39321 9999
*/
while(valid) {
......@@ -121,8 +95,8 @@ while(valid) {
iteration_cnt++;
}
#if defined (DEBUG_KRNL_LS)
printf("positive?: %u, iteration_cnt: %u, rho: %f, limit rho: %f\n", positive_direction, iteration_cnt, rho, DockConst_rho_lower_bound);
#if defined (DEBUG_KRNL_LS1)
printf("LS1 positive?: %u, iteration_cnt: %u, rho: %f, limit rho: %f\n", positive_direction, iteration_cnt, rho, DockConst_rho_lower_bound);
#endif
// -----------------------------------------------
......@@ -211,7 +185,7 @@ while(valid) {
write_channel_altera(chan_LS2Conf_LS1_genotype, tmp3);
#endif
#if defined (DEBUG_KRNL_LS)
#if defined (DEBUG_KRNL_LS1)
printf("LS1_genotype sent\n");
#endif
}
......@@ -304,8 +278,8 @@ while(valid) {
} // end of while (iteration_cnt) && (rho)
#if defined (DEBUG_KRNL_LS)
printf("Out of while iter LS\n");
#if defined (DEBUG_KRNL_LS1)
printf("Out of while iter LS1\n");
#endif
// write back data to GA
......@@ -329,7 +303,7 @@ while(valid) {
#if defined (DEBUG_ACTIVE_KERNEL)
printf(" %-20s: %s\n", "Krnl_LS", "disabled");
printf(" %-20s: %s\n", "Krnl_LS1", "disabled");
#endif
}
......
......@@ -2,7 +2,7 @@
// --------------------------------------------------------------------------
__kernel __attribute__ ((max_global_work_dim(0)))
void Krnl_LS2(
unsigned short DockConst_max_num_of_iters,
unsigned short DockConst_max_num_of_iters,
#if defined (FIXED_POINT_LS2)
fixedpt DockConst_rho_lower_bound,
fixedpt DockConst_base_dmov_mul_sqrt3,
......
......@@ -2,7 +2,7 @@
// --------------------------------------------------------------------------
__kernel __attribute__ ((max_global_work_dim(0)))
void Krnl_LS3(
unsigned short DockConst_max_num_of_iters,
unsigned short DockConst_max_num_of_iters,
#if defined (FIXED_POINT_LS3)
fixedpt DockConst_rho_lower_bound,
fixedpt DockConst_base_dmov_mul_sqrt3,
......
// --------------------------------------------------------------------------
// PRNG generators are implemented as Linear Feedback Shift Registers (LFSR)
// All are 32-bit LFRS, feedback taps: 30, 20, 26, 25
// --------------------------------------------------------------------------
__kernel __attribute__ ((max_global_work_dim(0)))
......@@ -113,93 +115,6 @@ void Krnl_Prng_GG_float(unsigned int Host_seed,
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#if 0
__kernel __attribute__ ((max_global_work_dim(0)))
void Krnl_Prng_LS123_ushort(unsigned int Host_seed1,
unsigned int Host_seed2,
unsigned int Host_seed3,
unsigned int DockConst_pop_size){
uint3 lfsr;
lfsr.x = Host_seed1;
lfsr.y = Host_seed2;
lfsr.z = Host_seed3;
/*
uint lfsr[3];
lfsr[0] = Host_seed1;
lfsr[1] = Host_seed2;
lfsr[2] = Host_seed3;
*/
bool valid = false;
while(!valid) {
bool active = true;
active = read_channel_nb_altera(chan_Arbiter_LS123_ushort_off, &valid);
ushort3 tmp;
uchar3 lsb;
lsb.x = lfsr.x & 0x01u;
lsb.y = lfsr.y & 0x01u;
lsb.z = lfsr.z & 0x01u;
lfsr.x >>= 1;
lfsr.y >>= 1;
lfsr.z >>= 1;
lfsr.x ^= (-lsb.x) & 0xA3000000u;
lfsr.y ^= (-lsb.y) & 0xA3000000u;
lfsr.z ^= (-lsb.z) & 0xA3000000u;
tmp.x = (DockConst_pop_size/MAX_UINT)*lfsr.x;
tmp.y = (DockConst_pop_size/MAX_UINT)*lfsr.y;
tmp.z = (DockConst_pop_size/MAX_UINT)*lfsr.z;
// to avoid having same entities undergoing LS simultaneously
if ((tmp.x == tmp.y) || (tmp.x == tmp.z) || (tmp.y == tmp.z)) {
tmp.y = tmp.x + 1;
tmp.z = tmp.y + 2;
}
bool success = false;
if(!valid) {
success = write_channel_nb_altera(chan_PRNG2GA_LS123_ushort_prng, tmp);
}
/*
ushort tmp[3];
#pragma unroll
for (uint i=0; i<3; i++){
uchar lsb[3];
lsb [i] = lfsr[i] & 0x01u;
lfsr[i] >>= 1;
lfsr[i] ^= (-lsb[i]) & 0xA3000000u;
tmp [i] = (DockConst_pop_size/MAX_UINT)*lfsr[i];
}
// to avoid having same entities undergoing LS simultaneously
if ((tmp[0] == tmp[1]) || (tmp[0] == tmp[2]) || (tmp[1] == tmp[2])) {
tmp[1] = tmp[0] + 1;
tmp[2] = tmp[1] + 2;
}
bool success = false;
ushort3 tmp123;
tmp123.x = tmp[0];
tmp123.y = tmp[1];
tmp123.z = tmp[2];
if(!valid) {
success = write_channel_nb_altera(chan_PRNG2GA_LS123_ushort_prng, tmp123);
}
*/
} // End of while(active)
}
#endif
__kernel __attribute__ ((max_global_work_dim(0)))
void Krnl_Prng_LS123_ushort(unsigned int Host_seed1,
unsigned int Host_seed2,
......@@ -241,7 +156,7 @@ void Krnl_Prng_LS123_ushort(unsigned int Host_seed1,
tmp [i] = (DockConst_pop_size/MAX_UINT)*lfsr[i];
}
// to avoid having same entities undergoing LS simultaneously
// To avoid having same entities undergoing LS simultaneously
if (
(tmp[0] == tmp[1]) || (tmp[0] == tmp[2]) || (tmp[0] == tmp[3]) || (tmp[0] == tmp[4]) || (tmp[0] == tmp[5]) || (tmp[0] == tmp[6]) || (tmp[0] == tmp[7]) || (tmp[0] == tmp[8]) ||
(tmp[1] == tmp[2]) || (tmp[1] == tmp[3]) || (tmp[1] == tmp[4]) || (tmp[1] == tmp[5]) || (tmp[1] == tmp[6]) || (tmp[1] == tmp[7]) || (tmp[1] == tmp[8]) ||
......
......@@ -149,25 +149,30 @@ static cl_kernel kernel16 = NULL;
static const char *name_k16 = "Krnl_LS2_Arbiter";
#endif
#endif
#if 0
#ifdef ENABLE_KERNEL17
static cl_command_queue command_queue17 = NULL;
static cl_kernel kernel17 = NULL;
static const char *name_k17 = "Krnl_Conform2";
#endif
#endif
#if 0
#ifdef ENABLE_KERNEL18
static cl_command_queue command_queue18 = NULL;
static cl_kernel kernel18 = NULL;
static const char *name_k18 = "Krnl_InterE2";
#endif
#endif
#if 0
#ifdef ENABLE_KERNEL19
static cl_command_queue command_queue19 = NULL;
static cl_kernel kernel19 = NULL;
static const char *name_k19 = "Krnl_IntraE2";
#endif
#endif
......@@ -195,17 +200,21 @@ static cl_kernel kernel22 = NULL;
static const char *name_k22 = "Krnl_LS3_Arbiter";
#endif
#endif
#if 0
#ifdef ENABLE_KERNEL23
static cl_command_queue command_queue23 = NULL;
static cl_kernel kernel23 = NULL;
static const char *name_k23 = "Krnl_Conf_Arbiter";
#endif
#endif
#if 0
#ifdef ENABLE_KERNEL24
static cl_command_queue command_queue24 = NULL;
static cl_kernel kernel24 = NULL;
static const char *name_k24 = "Krnl_Conf_Arbiter2";
#endif
#endif
#if 0
......@@ -1119,18 +1128,24 @@ unsigned char Host_cons_limit = (unsigned char) dockpars.cons_limit;
setKernelArg(kernel16,0, sizeof(unsigned char), &dockpars.num_of_genes);
#endif // End of ENABLE_KERNEL12