Commit d7cae178 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

Continue to update starpu opencl stuffs

parent 5d8596f4
......@@ -139,7 +139,6 @@ public:
/////////////////////////////////////////////////////////////////////////////////////
static void transferInPassCallback(void *buffers[], void *cl_arg){
FAssertLF(STARPU_VARIABLE_GET_PTR(buffers[0]) == STARPU_VARIABLE_GET_PTR(buffers[1]));
cl_mem currentCellsPtr = ((cl_mem)STARPU_VARIABLE_GET_PTR(buffers[0]));
size_t currentCellsSize = STARPU_VARIABLE_GET_ELEMSIZE(buffers[0]);
......
This diff is collapsed.
......@@ -37,7 +37,8 @@ protected:
}
template <class ParamClass, class... Args>
static void SetKernelArgs(cl_kernel& kernel, const int pos, ParamClass* param, Args... args){
FAssertLF(clSetKernelArg(kernel, pos, sizeof(*param), param) == 0);
FAssertLF(clSetKernelArg(kernel, pos, sizeof(*param), param) == 0,
"Error when assigning opencl argument ", pos);
SetKernelArgs(kernel, pos+1, args...);
}
......@@ -101,8 +102,8 @@ public:
FAssertLF( starpu_opencl_load_kernel(&kernel_transferInoutPassPerform, &queue_transferInoutPassPerform, &opencl_code, "FOpenCL__transferInoutPassPerform", workerDevid) == CL_SUCCESS);
FAssertLF( starpu_opencl_load_kernel(&kernel_downardPassPerform, &queue_downardPassPerform, &opencl_code, "FOpenCL__downardPassPerform", workerDevid) == CL_SUCCESS);
FAssertLF( starpu_opencl_load_kernel(&kernel_directInoutPassPerformMpi, &queue_directInoutPassPerformMpi, &opencl_code, "FOpenCL__directInoutPassPerformMpi", workerDevid) == CL_SUCCESS);
FAssertLF( starpu_opencl_load_kernel(&kernel_directInoutPassPerform, &queue_directInoutPassPerform, &opencl_code, "FOpenCL__directInPassPerform", workerDevid) == CL_SUCCESS);
FAssertLF( starpu_opencl_load_kernel(&kernel_directInPassPerform, &queue_directInPassPerform, &opencl_code, "FOpenCL__directInoutPassPerform", workerDevid) == CL_SUCCESS);
FAssertLF( starpu_opencl_load_kernel(&kernel_directInoutPassPerform, &queue_directInoutPassPerform, &opencl_code, "FOpenCL__directInoutPassPerform", workerDevid) == CL_SUCCESS);
FAssertLF( starpu_opencl_load_kernel(&kernel_directInPassPerform, &queue_directInPassPerform, &opencl_code, "FOpenCL__directInPassPerform", workerDevid) == CL_SUCCESS);
FAssertLF( starpu_opencl_load_kernel(&kernel_mergePassPerform, &queue_mergePassPerform, &opencl_code, "FOpenCL__mergePassPerform", workerDevid) == CL_SUCCESS);
}
}
......
This diff is collapsed.
#ifndef FTEXTREPLACER_HPP
#define FTEXTREPLACER_HPP
#include "../../Utils/FGlobal.hpp"
#include "../../Utils/FAssert.hpp"
#include <sstream>
#include <fstream>
#include <vector>
#include <memory>
#include <sstream>
class FTextReplacer{
protected:
std::vector<char> content;
size_t replaceCore(const size_t from, const char* keyStr, const size_t keyLength, const char* valueStr, const size_t valueLength){
if(keyLength == 0){
return content.size();
}
size_t iter = from;
while(iter < (content.size()-keyLength+1) && content[iter] != keyStr[0]){
iter += 1;
}
if(iter < (content.size()-keyLength+1)){
FAssertLF(content[iter] == keyStr[0]);
size_t counter = 0;
while(counter < keyLength && content[iter+counter] == keyStr[counter]){
counter += 1;
}
if(counter == keyLength){
// Found
if(keyLength < valueLength){
const size_t shift = valueLength-keyLength;
content.resize(content.size() + shift, '\0');
for(size_t idxCopy = content.size()-1 ; idxCopy > iter+shift ; --idxCopy){
content[idxCopy-shift] = content[idxCopy];
}
}
// Copy at pos iter
for(size_t idxCopy = 0 ; idxCopy < valueLength ; ++idxCopy){
content[iter + idxCopy] = valueStr[idxCopy];
}
// We shift some values
if(valueLength <= keyLength){
const size_t shift = keyLength-valueLength;
for(size_t idxCopy = iter+valueLength ; idxCopy < content.size()-shift ; ++idxCopy){
content[idxCopy] = content[idxCopy+shift];
}
content.resize(content.size()-shift);
}
}
return iter+1;
}
return content.size();
}
public:
FTextReplacer(const char* inFilename){
FAssertLF(inFilename);
FILE* kernelFile = fopen(inFilename, "r");
FAssertLF(kernelFile);
fseek(kernelFile, 0, SEEK_END);
const size_t kernelFileSize = ftell(kernelFile);
content.resize(kernelFileSize+1);
content[kernelFileSize] = '\0';
rewind(kernelFile);
FAssertLF(fread(content.data(), sizeof(char), kernelFileSize, kernelFile) == kernelFileSize);
fclose(kernelFile);
}
FTextReplacer(const char* inData, const size_t inLength){
content.resize(inLength+1);
content[inLength] = '\0';
memcpy(content.data(), inData, inLength);
}
size_t getLength() const{
return content.size();
}
const char* getContent() const{
return content.data();
}
template <class ValueClass>
int replaceAll(const char* keyStr, const ValueClass& value){
std::ostringstream stream;
stream << value;
const char* valueStr = stream.str().c_str();
const size_t keyLength = strlen(keyStr);
const size_t valueLength = strlen(valueStr);
int counterOccurence = 0;
size_t from = 0;
while((from = replaceCore(from, keyStr, keyLength, valueStr, valueLength)) != content.size()){
counterOccurence += 1;
}
return counterOccurence;
}
template <class ValueClass>
bool replaceOne(const char* keyStr, const ValueClass& value){
std::ostringstream stream;
stream << value;
const char* valueStr = stream.str().c_str();
return replaceCore(0, keyStr, strlen(keyStr), valueStr, strlen(valueStr)) != content.size();
}
};
#endif // FTEXTREPLACER_HPP
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