[highlighting]
is_line_number = true
token_charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
vec_extention = ["cu"]
vec_filename = []
single_line_comment = "//"
multi_line_comment_begin = "/*"
multi_line_comment_end = "*/"
is_escape_char = true
example = """
#include <stdio.h>
#include "hadamard_product_kernel.h"
#include <cuda_runtime_api.h> //to get cudaGetLastError(), cudaGetErrorString()
///Check is a cuda call was done well
/** @param linenr : line à laquelle on appelle la fonction
* @param fileName : nom du fichier dans lequel est l'appel de la fonction
* On utilise cette fonction comme ceci :
* phoenix_cudaCheckNoErr(__LINE__)
*
* Une macro existe pour remplacer cet appel de fonction :
* PHOENIX_CUDA_CHECK_FILE
*/
void phoenix_cudaCheckNoErrFileName(int linenr, const char* fileName){
cudaError_t err = cudaGetLastError();
if(err != cudaSuccess){
printf("phoenix_cudaCheckNoErr : File '%s' Error line %d : %s \\n", fileName, linenr, cudaGetErrorString(err));
abort();
}
}
///Compute a Hadamard Product with Cuda
/** @param[out] vecResultd : result of the computing
* @param vecXd : vector of values
* @param vecYd : vector of values
* @param nbElement : number of elements to be computed
*/
__global__ void hadamard_product_kernel(float * vecResultd, const float * vecXd, const float * vecYd, int nbElement){
int i = blockIdx.x*blockDim.x + threadIdx.x;
// if(i < nbElement)
vecResultd[i] = vecXd[i] * vecYd[i];
}
///Interface of the Hadamard product kernel
/** @param[out] vecResultd : result of the computing
* @param vecXd : vector of values
* @param vecYd : vector of values
* @param nbElement : number of elements to be computed
* @param maxNbThreadPerBlockX : maximum number of thread per block on X
* @param maxNbBlockX : maximum number of block in the grid on X
* @param warpSize : number of thread per warp
*/
void hadamard_product_cuda(float * vecResultd, const float * vecXd, const float * vecYd, int nbElement,
int maxNbThreadPerBlockX, int maxNbBlockX, int warpSize)
{
int dimGridX = 1;
int dimBlockX = 1;
if(nbElement > maxNbThreadPerBlockX){ //Here we will blocks to maximise the amount of work on flight
dimBlockX = maxNbThreadPerBlockX;
dimGridX = nbElement/dimBlockX;
}else{ //otherwise we use only one block
dimBlockX = nbElement;
}
dim3 dimGrid(dimGridX, 1, 1);
dim3 dimBlock(dimBlockX, 1, 1);
hadamard_product_kernel<<<dimGrid, dimBlock>>>(vecResultd, vecXd, vecYd, nbElement);
PHOENIX_CUDA_CHECK_FILE
}
"""
[[keyword]]
style = "dsType"
vec_token = [
"int",
"bool",
"char",
"long",
"void",
"short",
"const",
"float",
"double",
"size_t",
"unsigned",
"uint64_t",
"signed",
"static",
"GLint",
"GLuint",
"GLsizei",
"GLfloat",
"GLbolean",
"GLvoid",
"GLenum",
"GLchar",
"GLcharARB",
"GLboolean",
"Uint32",
"Uint16",
"Uint8",
"SDL_Surface",
"SDL_Keycode",
"SDL_Event",
"SDL_WindowID",
"SDL_GLContext",
"uint64_t",
"int64_t",
"uint32_t",
"int32_t",
"uint16_t",
"int16_t",
"uint8_t",
"int8_t",
"mutable",
"cpu_set_t",
"pthread_t",
"asm",
]
vec_match = []
[[keyword]]
style = "phoenixValue"
vec_token = [
"AllocMode::NONE",
"AllocMode::ALIGNED",
"AllocMode::PADDING",
"AllocMode",
"DEBUG",
"INFO",
"ALWAYS",
"WARNING",
"ERROR",
"CRITICAL",
"ConnectorMode::MOCK_RECORD",
"ConnectorMode::NO_MOCK",
"ConnectorMode::MOCK",
"PLog::Level",
"OptionType::NONE",
"OptionType::STRING",
"OptionType::FILENAME",
"OptionType::DIRECTORY",
"OptionType::FILE_OR_DIR",
"OptionType::BOOL",
"OptionType::CHAR",
"OptionType::SHORT",
"OptionType::INT",
"OptionType::LONG",
"OptionType::UCHAR",
"OptionType::USHORT",
"OptionType::UINT",
"OptionType::ULONG",
"OptionType::FLOAT",
"OptionType::DOUBLE",
"PImagePng::RGB",
"gnu",
"always_inline",
]
vec_match = []
[[keyword]]
style = "phoenixClass"
vec_token = [
"ProgressTime",
"PRegVecf",
"PTensor",
"PBlock",
"PStride",
"AllocMode",
"OptionParser",
"OptionMode",
"hsize_t",
"H5::DataSpace",
"H5::DataSet",
"H5::CompType",
"H5::Group",
"H5::ArrayType",
"H5::PredType",
"H5::H5File",
"NATIVE_FLOAT",
"NATIVE_FLOAT",
"NATIVE_DOUBLE",
"NATIVE_INT",
"PhoenixAllocator",
"PhoenixAlignedAllocator",
"PhoenixVectorAllocator",
"PhoenixMemCpy",
"PAbstractControlManager",
"PMockControlBackend",
"PEmptyControlBackend",
"PFunctionPrototype",
"PMockConnectorCall",
"PLog",
"PComposeVar",
"PMockConnectorVar",
"PFunctionCall",
"PEmptyManagerData",
"PEmptyConnectorData",
"PEmptyManagerParam",
"PEmptyControlParam",
"PImagePng",
"PColorMap",
"ProgressBarr",
"PPath",
"PString",
]
vec_match = []
[[keyword]]
style = "phoenixTypedef"
vec_token = [
"ConnectorManager",
"Manager",
"Connector",
"Message",
"Param",
"MgrParam",
]
vec_match = []
[[keyword]]
style = "phoenixFunction"
vec_token = [
"plib_load_ps",
"plib_store_ps",
"plib_add_ps",
"plib_sub_ps",
"plib_mul_ps",
"plib_broadcast_ss",
"reshuffle_broadcastTensor",
"micro_benchmarkAutoNsPrint",
"micro_benchmarkParseArg",
"phoenix_check",
"phoenix_getComposeVar",
"phoenix_getComposeType",
"phoenix_getPrototype",
"phoenix_emptyControlParam",
"phoenix_emptyManagerParam",
"phoenix_mockControlParam",
"phoenix_managerControlParam",
"phoenix_getControlMockFileVar",
"phoenix_mockCreate",
"phoenix_mockVarAppendData",
"phoenix_mockSave",
"createDirectoriesIfNotExist",
"ts_pcomposeVarToStr",
"ts_protoTypeToStr",
]
vec_match = []
[[keyword]]
style = "phoenixMethod"
vec_token = [
"addClientConnector",
"addServerConnector",
"registerCall",
"setName",
"getVecParam",
"getVecReturnType",
"registerVar",
"setType",
"registerLocalVar",
"registerLocalCall",
"setLocalVar",
"getLocalVar",
"defaultParam",
"defaultMgrParam",
"initialiseDataManager",
"createClientConnector",
"createServerConnector",
"pushData",
"pullData",
"push",
"pull",
"call",
"msgSize",
"msgResize",
"msgData",
"closeMgr",
"close",
"isConnected",
"getLogAlways",
"getLogInfo",
"getLogError",
"getLogCritical",
"getLogDebug",
"is_open",
"open",
]
vec_match = []
[[keyword]]
style = "phoenixMacro"
vec_token = [
"phoenix_assert",
"PLIB_VECTOR_SIZE_FLOAT",
"PLIB_VECTOR_SIZE_INT",
"PHOENIX_CUDA_CHECK_FILE",
"CUDA_DEVICE_CHECK",
"CUDA_CALL_CHECK",
]
vec_match = []
[[keyword]]
style = "cudaType"
vec_token = [
"dim2",
"dim3",
"cudaError_t",
"cudaDeviceProp",
"cufftComplex",
"cufftHandle",
"cudaGraphNode_t",
"cudaGraph_t",
"cudaGraphNodeParams",
"cudaGraphExec_t",
"cudaStream_t",
]
vec_match = []
[[keyword]]
style = "cudaKeyword"
vec_token = [
"cudaMemcpyHostToDevice",
"cudaMemcpyDeviceToHost",
"cudaMemcpyHostToHost",
"cudaMemcpyDeviceToDevice",
"cudaGraphNodeTypeKernel",
"cudaGraphDebugDotFlagsVerbose",
"blockIdx.x",
"blockDim.x",
"threadIdx.x",
"blockIdx.y",
"blockDim.y",
"threadIdx.y",
"blockIdx.z",
"blockDim.z",
"threadIdx.z",
"blockIdx",
"blockDim",
"threadIdx",
"__global__",
"__host__",
"__device__",
"cudaSuccess",
"CURAND_RNG_PSEUDO_DEFAULT",
"CURAND_RNG_PSEUDO_XORWOW",
"CURAND_RNG_PSEUDO_MRG32K3A",
"CURAND_RNG_PSEUDO_MTGP32",
"CURAND_RNG_PSEUDO_MT19937",
"CURAND_RNG_PSEUDO_PHILOX4_32_10",
"CURAND_RNG_QUASI_DEFAULT",
"CURAND_RNG_QUASI_SOBOL32",
"CURAND_RNG_QUASI_SCRAMBLED_SOBOL32",
"CURAND_RNG_QUASI_SOBOL64",
"CURAND_RNG_QUASI_SCRAMBLED_SOBOL64",
"CUFFT_FORWARD",
"CUFFT_C2C",
]
vec_match = [
"<<<",
">>>"
]
[[keyword]]
style = "dsKeyword"
vec_token = [
"return",
"if",
"else",
"for",
"while",
"do",
"switch",
"case",
"default",
"break",
"typedef",
"enum",
"struct",
"inline",
"sizeof",
"true",
"false",
"new",
"delete",
"class",
"public",
"private",
"protected",
"virtual",
"using",
"namespace",
"operator",
"this",
"friend",
"extern",
"continue",
"union",
"export",
"template",
"typename",
"volatile",
"EXIT_FAILURE",
"throw",
"auto",
"except",
"noexcept",
"catch",
"constexpr",
]
vec_match = []
[[keyword]]
style = "cppstdF"
vec_token = [
"cout",
"endl",
"cerr",
"cin",
"stringstream",
"string",
"list",
"iterator",
"reverse_iterator",
"const_iterator",
"const_reverse_iterator",
"vector",
"ostream",
"istream",
"ofstream",
"ifstream",
"map",
"pair",
"std",
"setw",
"views",
"ranges",
"iota_view",
"repeat",
"join",
"zip",
"span",
"mdspan",
"cartesian_product",
"normal_distribution",
"hardware_concurrency",
"random_device",
"mt19937",
"iota",
"fill",
"transform_reduce",
"transform",
"for_each",
"sort",
"generate_n",
"generate",
"execution",
"par_unseq",
"unseq",
"seq",
"par",
"plus",
"reduce",
"accumulate",
"min",
"max",
"bad_array_new_length",
"bad_alloc",
"aligned_alloc",
"static_cast",
"numeric_limits",
"chrono",
"steady_clock",
"nanoseconds",
"time_point",
"allocator",
"thread",
]
vec_match = []
[[keyword]]
style = "cppstandardF"
vec_token = [
"assert",
"printf",
"scanf",
"sprintf",
"sscanf",
"fprintf",
"fscanf",
"fopen",
"fclose",
"fgetc",
"fgets",
"getc",
"gets",
"strstr",
"strcmp",
"strchr",
"malloc",
"free",
"main",
"push_back",
"push_front",
"pop_back",
"pop_front",
"begin",
"end",
"back",
"size",
"data",
"memset",
"memcpy",
"c_str",
"front",
"erase",
"insert",
"append",
"empty",
"clear",
"resize",
"rbegin",
"rend",
"exit",
"perror",
"pthread_self",
"pthread_setaffinity_np",
"pthread_getaffinity_np",
"posix_memalign",
"memalign",
"now",
"__assert_fail",
"glTexImage2D",
"glIsTexture",
"glBindTexture",
"glDeleteTextures",
"glGenTextures",
"glTexParameteri",
"glEnable",
"glTexParameterf",
"glActiveTexture",
"glCreateShader",
"glShaderSource",
"glCompileShader",
"glGetShaderiv",
"glGetShaderInfoLog",
"glGetProgramInfoLog",
"glEnableVertexAttribArray",
"glDisableVertexAttribArray",
"glVertexAttribPointer",
"glDrawElements",
"glBufferData",
"glBufferSubData",
"glBindBuffer",
"glIsBuffer",
"glBindVertexArray",
"glDeleteVertexArrays",
"glDeleteBuffers",
"glGenVertexArrays",
"glRenderbufferStorage",
"glIsRenderbuffer",
"glDeleteRenderbuffers",
"glGenRenderbuffers",
"glBindRenderbuffer",
"glGenFramebuffers",
"glBindFramebuffer",
"glDeleteFramebuffers",
"glIsFramebuffer",
"glFramebufferTexture2D",
"glFramebufferRenderbuffer",
"glCheckFramebufferStatus",
"SDL_CreateRGBSurface",
"SDL_FreeSurface",
"dlopen",
"dlclose",
"dlerror",
"dlsym",
"dlvsym",
"dladdr",
"abort",
"atoi",
"sin",
"cos",
"tan",
"exp",
"sqrt",
"abs",
"asin",
"acos",
"atan",
"sinf",
"cosf",
"tanf",
"expf",
"sqrtf",
"absf",
"fabsf",
"asinf",
"acosf",
"atanf",
"_mm256_load_ps",
"_mm256_loadu_ps",
"_mm256_store_ps",
"_mm256_storeu_ps",
"_mm256_add_ps",
"_mm256_mul_ps",
"_mm256_broadcast_ss",
]
vec_match = []
[[keyword]]
style = "cudaFunction"
vec_token = [
"cudaMemcpy",
"cudaMallocHost",
"cudaMalloc",
"cudaFree",
"cudaGetDeviceCount",
"cudaSetDevice",
"cudaGetDeviceProperties",
"cudaGetErrorString",
"cudaGetLastError",
"cudaPeekAtLastError",
"cudaStreamCreate",
"cudaStreamDestroy",
"cudaStreamSynchronize",
"cudaGraphAddNode",
"cudaGraphCreate",
"cudaGraphDestroy",
"cudaGraphInstantiate",
"cudaGraphDebugDotPrint",
"cudaGraphLaunch",
"thrust::tuple",
"thrust::zip_iterator",
"thrust::make_zip_iterator",
"thrust::get",
"thrust::make_tuple",
"thrust",
"zip_iterator",
"host_vector",
"device_vector",
"curandGenerator_t",
"curandCreateGenerator",
"curandSetPseudoRandomGeneratorSeed",
"curandGenerateNormal",
"curandDestroyGenerator",
"cufftPlanMany",
"cudaDeviceSynchronize",
"cufftDestroy",
"cufftExecC2C",
]
vec_match = []
[[keyword]]
style = "cppglMacro"
vec_token = [
"GL_TEXTURE_2D",
"GL_TRUE",
"GL_FALSE",
"GL_TEXTURE_WRAP_S",
"GL_TEXTURE_WRAP_T",
"GL_REPEAT",
"GL_LINEAR_MIPMAP_NEAREST",
"GL_LINEAR",
"GL_TEXTURE_MIN_FILTER",
"GL_TEXTURE_MAG_FILTER",
"GL_TEXTURE_BASE_LEVEL",
"GL_TEXTURE_MAX_LEVEL",
"GL_UNSIGNED_BYTE",
"GL_NEAREST",
"GL_RGB",
"GL_RGBA",
"GL_COMPILE_STATUS",
"GL_INFO_LOG_LENGTH",
"GL_FLOAT",
"GL_TRIANGLES",
"GL_LINE_STRIP",
"GL_LINE_LOOP",
"GL_LINES",
"GL_UNSIGNED_INT",
"GL_ARRAY_BUFFER",
"GL_STATIC_DRAW",
"GL_LINE_STRIP",
"GL_TEXTURE0",
"GL_TEXTURE1",
"GL_RENDERBUFFER",
"GL_FRAMEBUFFER",
"GL_DEPTH24_STENCIL8",
"GL_COLOR_ATTACHMENT0",
"GL_DEPTH_STENCIL_ATTACHMENT",
"GL_FRAMEBUFFER_COMPLETE",
"__LINE__",
]
vec_match = []
[[keyword]]
style = "cppqtMacro"
vec_token = [
"__restrict__",
"__asm__",
"__m256",
"PyObject",
"PyArrayObject",
"Q_OBJECT",
"SIGNAL",
"SLOT",
"connect",
"signals",
"slots",
"disconnect",
]
vec_match = []
[[keyword]]
style = "pythonApiFunction"
vec_token = [
"PyCFunction",
"PyMethodDef",
"PyModuleDef",
"PyModule_Create",
"import_array",
"PyArg_ParseTuple",
"PyErr_SetString",
"PyArray_NDIM",
"PyArray_DIMS",
"PyArray_DATA",
"Py_BuildValue",
]
vec_match = []
[[keyword]]
style = "pythonApiMacro"
vec_token = [
"PyModuleDef_HEAD_INIT",
"PyMODINIT_FUNC",
"METH_VARARGS",
"METH_NOARGS",
"Py_RETURN_NONE",
"NULL",
]
vec_match = []
[[keyword]]
style = "pythonApiPyObject"
vec_token = [
"PyExc_RuntimeError",
"PyExc_TypeError",
]
vec_match = []
[[keyword]]
style = "bultinFunction"
vec_token = [
"__builtin_assume_aligned",
]
vec_match = []
[[keyword]]
style = "cppmacro"
vec_token = [
"__PROGRAM_VERSION__",
"PLIB_CUDA_CHECK_FILE",
"H5F_ACC_RDONLY",
"H5F_ACC_TRUNC",
"CPU_ZERO",
"CPU_SET",
"handle_error_en",
"PIN_THREAD_TO_CORE",
]
vec_match = []
[[getuntil]]
style = "dsString"
start_token = "\""
end_token = "\""
[[getuntil]]
style = "dsChar"
start_token = "'"
end_token = "'"
[[getuntil]]
style = "cppmacro"
start_token = "#"
end_token = "\n"
[[getuntil]]
style = "dsCommentMono"
start_token = "////"
end_token = "\n"
[[getuntil]]
style = "dsCommentMulti"
start_token = "/***"
end_token = "*/"
[[getuntil]]
style = "dsDocMono"
start_token = "///"
end_token = "\n"
[[getuntil]]
style = "dsDocMulti"
start_token = "/**"
end_token = "*/"
[[getuntil]]
style = "dsCommentMono"
start_token = "//"
end_token = "\n"
[[getuntil]]
style = "dsCommentMulti"
start_token = "/*"
end_token = "*/"
[[sequence]]
style = "dsNumber"
vec_step = [
{oneof = "1234567890"},
{oneof = "lu"}
]
[[sequence]]
style = "dsNumber"
vec_step = [
{token = "."},
{oneof = "1234567890"},
{oneof = "f"}
]
[[sequence]]
style = "dsNumber"
vec_step = [
{token = "0x"},
{oneof = "1234567890abcdef"},
]
[[sequence]]
style = "dsNumber"
vec_step = [
{token = "0b"},
{oneof = "10"},
]
[[sequence]]
style = "dsNumber"
vec_step = [
{token = "0"},
]