Commit 4a59677b authored by BRAMAS Berenger's avatar BRAMAS Berenger

Update OpenCL to use POD struct

parent 1f77bf7c
......@@ -19,11 +19,6 @@
#include <cstddef>
#include "FBasicCell.hpp"
// To get access to descriptors
class FTestCellCudaDescriptor;
class FTestCellCudaConstDescriptor;
struct FTestCell_Alignement;
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FBasicCell*
......@@ -116,11 +111,6 @@ public:
int getSavedSizeUp() {
return int(sizeof(long long int));
}
// To get access to descriptor
friend class FTestCellCudaDescriptor;
friend class FTestCellCudaConstDescriptor;
friend struct FTestCell_Alignement;
};
#endif //FTESTCELL_HPP
......
......@@ -93,7 +93,7 @@ public:
if(filename){
starpu_opencl_get_context (workerDevid, &context);
const int err = starpu_opencl_load_opencl_from_string(filename, &opencl_code, "-cl-std=CL2.0 -cl-mad-enable -Werror");
const int err = starpu_opencl_load_opencl_from_string(filename, &opencl_code, "-cl-std=CL2.0 -cl-mad-enable -Werror -w");
if(err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
FAssertLF( starpu_opencl_load_kernel(&kernel_bottomPassPerform, &queue_bottomPassPerform, &opencl_code, "FOpenCL__bottomPassPerform", workerDevid) == CL_SUCCESS);
......@@ -171,16 +171,16 @@ public:
kernelFilename.getNbGroups(), kernelFilename.getGroupSize(), 0, NULL, NULL);
if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
struct starpu_task* tsk = starpu_task_get_current();
FAssertLF(tsk);
starpu_data_handle_t handle = STARPU_TASK_GET_HANDLE( tsk, 0);
FAssertLF(handle);
// todo TODO struct starpu_task* tsk = starpu_task_get_current();
// FAssertLF(tsk);
// starpu_data_handle_t handle = STARPU_TASK_GET_HANDLE( tsk, 0);
// FAssertLF(handle);
//starpu_data_acquire(handle, STARPU_RW);
//starpu_data_release(handle);
//uintptr_t dataTest = ((starpu_variable_interface2*)(((_starpu_data_replicate2*)(handle->per_node))->data_interface))->ptr;//((starpu_variable_interface*)(handle->per_node[0]->data_interface))->ptr;
void* data = starpu_data_get_local_ptr( handle);
FAssertLF(data && starpu_data_get_size(handle) == leafCellsSize);
std::cout << "currentCells data " << data << "\n";
// void* data = starpu_data_get_local_ptr( handle);
// FAssertLF(data && starpu_data_get_size(handle) == leafCellsSize);
// std::cout << "currentCells data " << data << "\n";
//const int errcode_ret = clEnqueueReadBuffer(queue_bottomPassPerform, leafCellsPtr,
// CL_TRUE, 0, leafCellsSize, data, 0, NULL, NULL);
//FAssertLF(errcode_ret == CL_SUCCESS, "OpenCL error code " , errcode_ret);
......
This diff is collapsed.
......@@ -2,23 +2,9 @@
#define FTESTOPENCLCODE_HPP
#include "../../Utils/FGlobal.hpp"
#include "../../Components/FTestCell.hpp"
#include "../FStarPUDefaultAlign.hpp"
#include "FTextReplacer.hpp"
struct FTestCell_Alignement{
static const int dataUp;
static const int dataDown;
static const int mindex;
static const int coord;
};
const int FTestCell_Alignement::dataUp = reinterpret_cast<std::size_t>(&((reinterpret_cast<FTestCell*>(0xF00))->dataUp)) - std::size_t(0xF00);
const int FTestCell_Alignement::dataDown = reinterpret_cast<std::size_t>(&((reinterpret_cast<FTestCell*>(0xF00))->dataDown)) - std::size_t(0xF00);
const int FTestCell_Alignement::mindex = reinterpret_cast<std::size_t>(&((reinterpret_cast<FTestCell*>(0xF00))->mortonIndex)) - std::size_t(0xF00);
const int FTestCell_Alignement::coord = reinterpret_cast<std::size_t>(&((reinterpret_cast<FTestCell*>(0xF00))->coordinate)) - std::size_t(0xF00);
// Initialize the types
class FTestOpenCLCode{
FTextReplacer kernelfile;
......@@ -29,13 +15,9 @@ public:
FTestOpenCLCode() : kernelfile("/home/berenger/Projets/ScalfmmGit/scalfmm/Src/GroupTree/OpenCl/FTestKernel.cl"){
kernelfile.replaceAll("___FReal___", "double");
kernelfile.replaceAll("___FParticleValueClass___", "long long");
kernelfile.replaceAll("___FCellClassSize___", sizeof(FTestCell));
kernelfile.replaceAll("___NbAttributesPerParticle___", 2);
kernelfile.replaceAll("___FCellUpOffset___", FTestCell_Alignement::dataUp);
kernelfile.replaceAll("___FCellDownOffset___", FTestCell_Alignement::dataDown);
kernelfile.replaceAll("___FCellMortonOffset___", FTestCell_Alignement::mindex);
kernelfile.replaceAll("___FCellCoordinateOffset___", FTestCell_Alignement::coord);
kernelfile.replaceAll("___DefaultStructAlign___", FStarPUDefaultAlign::StructAlign);
const size_t structAlign = FStarPUDefaultAlign::StructAlign;
kernelfile.replaceAll("___DefaultStructAlign___", structAlign);
dim = 1;
}
......
......@@ -38,7 +38,7 @@
#include "../../Src/GroupTree/FStarPUKernelCapacities.hpp"
#include "../../Src/GroupTree/OpenCl/FTestOpenCLCode.hpp"
#include "../../Src/GroupTree/FTestCellPOD.hpp"
int main(int argc, char* argv[]){
......@@ -59,7 +59,7 @@ int main(int argc, char* argv[]){
FParameterDefinitions::OctreeHeight, FParameterDefinitions::NbThreads,
FParameterDefinitions::NbParticles, LocalOptionBlocSize);
typedef FTestCell GroupCellClass;
typedef FTestCellPOD GroupCellClass;
typedef FGroupTestParticleContainer GroupContainerClass;
typedef FGroupTree< GroupCellClass, GroupContainerClass, 2, long long int> GroupOctreeClass;
typedef FStarPUAllCpuOpenCLCapacities<FTestKernels< GroupCellClass, GroupContainerClass >> GroupKernelClass;
......
Markdown is supported
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