Commit 740a515a authored by Leonardo Solis's avatar Leonardo Solis
Browse files

#31, party ported opencl setup: several changes

compiles but errors are detected in swemu


Former-commit-id: c15a9736
parent fdda9657
...@@ -113,7 +113,7 @@ CXXFLAGS:=-Wall -O0 -g -std=c++14 $(OTHER_FLAGS) ...@@ -113,7 +113,7 @@ CXXFLAGS:=-Wall -O0 -g -std=c++14 $(OTHER_FLAGS)
# Host Application # Host Application
hostbin_SRCS=$(wildcard ../common/src/AOCLUtils/*.cpp wrapcl/src/*.cpp host/src/*.cpp) \ hostbin_SRCS=$(wildcard ./host/src/*.cpp) \
$(oclHelper_SRCS) \ $(oclHelper_SRCS) \
$(xcl2_SRCS) $(xcl2_SRCS)
...@@ -391,8 +391,8 @@ kerrpt-sw: ...@@ -391,8 +391,8 @@ kerrpt-sw:
# Compile for sw and hw emulation # Compile for sw and hw emulation
kerswemu: kerswemu:
make all TARGETS=sw_emu DEVICES=$(BOARD) make all TARGETS=sw_emu DEVICES=$(BOARD)
cp ./xclbin/$(XCLBINS).sw_emu.*.xclbin . #cp ./xclbin/$(XCLBINS).sw_emu.*.xclbin .
mv ./$(XCLBINS).sw_emu.*.xclbin ./$(XCLBINS).xclbin #mv ./$(XCLBINS).sw_emu.*.xclbin ./$(XCLBINS).xclbin
@echo $(newline) @echo $(newline)
@echo "===============================================================================" @echo "==============================================================================="
@echo "INFO: sw emulation file created under: \"./xclbin/$(XCLBINS).sw_emu.*.xclbin\" " @echo "INFO: sw emulation file created under: \"./xclbin/$(XCLBINS).sw_emu.*.xclbin\" "
......
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
#include "Kernels.h" #include "Kernels.h"
//#include "ImportBinary.h" //#include "ImportBinary.h"
//#include "ImportSource.h" //#include "ImportSource.h"
#include "BufferObjects.h" #include "BufferObjects.h"
#include "xcl2.hpp"
#include <vector>
using std::vector;
#define ELAPSEDSECS(stop,start) ((float) stop-start)/((float) CLOCKS_PER_SEC) #define ELAPSEDSECS(stop,start) ((float) stop-start)/((float) CLOCKS_PER_SEC)
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
#include "miscellaneous.h" #include "miscellaneous.h"
// Added for allocating fgrids
#include <vector>
using std::vector;
#define getvalue_4Darr(mempoi, grinf, t, z, y, x) *(mempoi + (grinf).size_xyz[0] * (y + (grinf).size_xyz[1] * (z + (grinf).size_xyz[2]*t)) + x) #define getvalue_4Darr(mempoi, grinf, t, z, y, x) *(mempoi + (grinf).size_xyz[0] * (y + (grinf).size_xyz[1] * (z + (grinf).size_xyz[2]*t)) + x)
#define getvalue_4Darr_withsize(mempoi, gridsize_xyz, t, z, y, x) *(mempoi + gridsize_xyz[0]*(y + gridsize_xyz[1] * (z + gridsize_xyz[2]*t)) + x) #define getvalue_4Darr_withsize(mempoi, gridsize_xyz, t, z, y, x) *(mempoi + gridsize_xyz[0]*(y + gridsize_xyz[1] * (z + gridsize_xyz[2]*t)) + x)
//The macro helps to access the grid point values //The macro helps to access the grid point values
...@@ -41,6 +45,6 @@ typedef struct ...@@ -41,6 +45,6 @@ typedef struct
int get_gridinfo(const char*, Gridinfo*); int get_gridinfo(const char*, Gridinfo*);
int get_gridvalues_f(const Gridinfo* mygrid, int get_gridvalues_f(const Gridinfo* mygrid,
float** fgrids); float* fgrids);
#endif /* PROCESSGRID_H_ */ #endif /* PROCESSGRID_H_ */
...@@ -26,8 +26,6 @@ int main(int argc, char* argv[]) ...@@ -26,8 +26,6 @@ int main(int argc, char* argv[])
Liganddata myligand_init; Liganddata myligand_init;
Dockpars mypars; Dockpars mypars;
float* floatgrids;
clock_t clock_start_program, clock_stop_program; clock_t clock_start_program, clock_stop_program;
...@@ -57,6 +55,11 @@ int main(int argc, char* argv[]) ...@@ -57,6 +55,11 @@ int main(int argc, char* argv[])
if (get_gridinfo(mypars.fldfile, &mygrid) != 0) if (get_gridinfo(mypars.fldfile, &mygrid) != 0)
return 1; return 1;
//allocating CPU memory for floatgrids
size_t size_fgrid_nelems = (mygrid.num_of_atypes+2) * mygrid.size_xyz[0] * mygrid.size_xyz[1] * mygrid.size_xyz[2];
vector<float,aligned_allocator<float>> floatgrids(size_fgrid_nelems);
// Filling the atom types filed of myligand according to the grid types // Filling the atom types filed of myligand according to the grid types
if (init_liganddata(mypars.ligandfile, &myligand_init, &mygrid) != 0) if (init_liganddata(mypars.ligandfile, &myligand_init, &mygrid) != 0)
return 1; return 1;
...@@ -66,7 +69,7 @@ int main(int argc, char* argv[]) ...@@ -66,7 +69,7 @@ int main(int argc, char* argv[])
return 1; return 1;
//Reading the grid files and storing values in the memory region pointed by floatgrids //Reading the grid files and storing values in the memory region pointed by floatgrids
if (get_gridvalues_f(&mygrid, &floatgrids) != 0) if (get_gridvalues_f(&mygrid, floatgrids.data()) != 0)
return 1; return 1;
//------------------------------------------------------------ //------------------------------------------------------------
...@@ -85,7 +88,7 @@ int main(int argc, char* argv[]) ...@@ -85,7 +88,7 @@ int main(int argc, char* argv[])
print_ref_lig_energies_f(myligand_init, print_ref_lig_energies_f(myligand_init,
mypars.smooth, mypars.smooth,
mygrid, mygrid,
floatgrids, floatgrids.data(),
mypars.coeffs.scaled_AD4_coeff_elec, mypars.coeffs.scaled_AD4_coeff_elec,
mypars.coeffs.AD4_coeff_desolv, mypars.coeffs.AD4_coeff_desolv,
mypars.qasp); mypars.qasp);
...@@ -94,11 +97,9 @@ int main(int argc, char* argv[]) ...@@ -94,11 +97,9 @@ int main(int argc, char* argv[])
//------------------------------------------------------------ //------------------------------------------------------------
// Starting Docking // Starting Docking
//------------------------------------------------------------ //------------------------------------------------------------
if (docking_with_gpu(&mygrid, floatgrids, &mypars, &myligand_init, &argc, argv, clock_start_program) != 0) if (docking_with_gpu(&mygrid, floatgrids.data(), &mypars, &myligand_init, &argc, argv, clock_start_program) != 0)
return 1; return 1;
if(floatgrids) {free(floatgrids);}
/* /*
clock_stop_program = clock(); clock_stop_program = clock();
printf("Program run time: %.3f sec\n", ELAPSEDSECS(clock_stop_program, clock_start_program)); printf("Program run time: %.3f sec\n", ELAPSEDSECS(clock_stop_program, clock_start_program));
......
#include "processgrid.h" #include "processgrid.h"
#include "AOCLUtils/aocl_utils.h"
using namespace aocl_utils;
int get_gridinfo(const char* fldfilename, Gridinfo* mygrid) int get_gridinfo(const char* fldfilename, Gridinfo* mygrid)
{ {
...@@ -99,7 +96,7 @@ int get_gridinfo(const char* fldfilename, Gridinfo* mygrid) ...@@ -99,7 +96,7 @@ int get_gridinfo(const char* fldfilename, Gridinfo* mygrid)
return 0; return 0;
} }
int get_gridvalues_f(const Gridinfo* mygrid, float** fgrids) int get_gridvalues_f(const Gridinfo* mygrid, float* fgrids)
//The function reads the grid point values from the .map files //The function reads the grid point values from the .map files
//that correspond to the receptor given by the first parameter. //that correspond to the receptor given by the first parameter.
//It allocates the proper amount of memory and stores the data there, //It allocates the proper amount of memory and stores the data there,
...@@ -112,23 +109,13 @@ int get_gridvalues_f(const Gridinfo* mygrid, float** fgrids) ...@@ -112,23 +109,13 @@ int get_gridvalues_f(const Gridinfo* mygrid, float** fgrids)
char tempstr [128]; char tempstr [128];
float* mypoi; float* mypoi;
/* if (fgrids == NULL)
*fgrids = (float*) malloc((sizeof(float))*(mygrid->num_of_atypes+2)*
(mygrid->size_xyz[0])*
(mygrid->size_xyz[1])*
(mygrid->size_xyz[2]));
*/
*fgrids = (float*) alignedMalloc((sizeof(float))*(mygrid->num_of_atypes+2)*
(mygrid->size_xyz[0])*
(mygrid->size_xyz[1])*
(mygrid->size_xyz[2]));
if (*fgrids == NULL)
{ {
printf("Error: not enough memory!\n"); printf("Error: not enough memory!\n");
return 1; return 1;
} }
mypoi = *fgrids; mypoi = fgrids;
for (t=0; t < mygrid->num_of_atypes+2; t++) for (t=0; t < mygrid->num_of_atypes+2; t++)
{ {
......
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