Skip to content

Commit aa61d3a

Browse files
committed
GPU CMake: Create const param files for available default architectures to be loaded by RTC
1 parent 074b111 commit aa61d3a

File tree

3 files changed

+39
-19
lines changed

3 files changed

+39
-19
lines changed

GPU/GPUTracking/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,30 @@ target_sources(${targetName}
407407
FILES ${GENERATED_HEADERS_LIST}
408408
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
409409

410+
make_directory(${CMAKE_CURRENT_BINARY_DIR}/genGPUArch)
411+
set(GPU_CONST_PARAM_ARCHITECTUES AMPERE TURING VEGA MI2xx)
412+
set(GPU_CONST_PARAM_FILES "")
413+
foreach(GPU_ARCH ${GPU_CONST_PARAM_ARCHITECTUES})
414+
set(PARAMFILE ${CMAKE_CURRENT_BINARY_DIR}/genGPUArch/gpu_const_param_${GPU_ARCH}.par)
415+
add_custom_command(
416+
OUTPUT ${PARAMFILE}
417+
COMMAND bash -c
418+
"echo -e '#define GPUCA_GPUTYPE_${GPU_ARCH}\\n#define PARAMETER_FILE \"GPUDefParametersDefaults.h\"\\ngInterpreter->AddIncludePath(\"${CMAKE_CURRENT_SOURCE_DIR}/Definitions\");\\ngInterpreter->AddIncludePath(\"${ON_THE_FLY_DIR}\");\\n.x ${CMAKE_CURRENT_SOURCE_DIR}/Standalone/tools/dumpGPUDefParam.C(\"${PARAMFILE}\")\\n.q\\n'"
419+
| root -l -b > /dev/null
420+
VERBATIM
421+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/genGPUArch
422+
MAIN_DEPENDENCY Standalone/tools/dumpGPUDefParam.C
423+
DEPENDS Definitions/GPUDefParametersDefaults.h
424+
${ON_THE_FLY_DIR}/GPUDefParametersLoadPrepare.h
425+
${ON_THE_FLY_DIR}/GPUDefParametersLoad.inc
426+
COMMENT "Generating GPU parameter set for architecture ${GPU_ARCH}")
427+
LIST(APPEND GPU_CONST_PARAM_FILES ${PARAMFILE})
428+
endforeach()
429+
430+
add_custom_target(${MODULE}_GPU_CONST_PARAM_ARCHS ALL DEPENDS ${GPU_CONST_PARAM_FILES})
431+
install(FILES ${GPU_CONST_PARAM_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/GPU)
432+
433+
410434
# Add compile definitions and libraries depending on available optional dependencies
411435
if(GPUCA_QA)
412436
message(STATUS "Building GPU QA")

GPU/GPUTracking/Definitions/GPUDefParametersDefaults.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
// GPU Run Configuration
2424
#if defined(GPUCA_GPUCODE) && !defined(GPUCA_GPUCODE_GENRTC) && !defined(GPUCA_GPUCODE_NO_LAUNCH_BOUNDS) // Avoid including for RTC generation besides normal include protection.
25+
#define GPUCA_LB_SCAN 512
2526
// GPU-architecture-dependent default settings
2627
#if defined(GPUCA_GPUTYPE_MI2xx)
2728
#define GPUCA_WARP_SIZE 64
@@ -498,11 +499,11 @@
498499
#define GPUCA_LB_GPUTPCNNClusterizerKernels_publishClass1Regression GPUCA_LB_GPUTPCNNClusterizerKernels
499500
#define GPUCA_LB_GPUTPCNNClusterizerKernels_publishClass2Regression GPUCA_LB_GPUTPCNNClusterizerKernels
500501

501-
#define GPUCA_LB_GPUTPCCFStreamCompaction_scanStart GPUCA_THREAD_COUNT_SCAN
502-
#define GPUCA_LB_GPUTPCCFStreamCompaction_scanUp GPUCA_THREAD_COUNT_SCAN
503-
#define GPUCA_LB_GPUTPCCFStreamCompaction_scanTop GPUCA_THREAD_COUNT_SCAN
504-
#define GPUCA_LB_GPUTPCCFStreamCompaction_scanDown GPUCA_THREAD_COUNT_SCAN
505-
#define GPUCA_LB_GPUTPCCFStreamCompaction_compactDigits GPUCA_THREAD_COUNT_SCAN
502+
#define GPUCA_LB_GPUTPCCFStreamCompaction_scanStart GPUCA_LB_SCAN
503+
#define GPUCA_LB_GPUTPCCFStreamCompaction_scanUp GPUCA_LB_SCAN
504+
#define GPUCA_LB_GPUTPCCFStreamCompaction_scanTop GPUCA_LB_SCAN
505+
#define GPUCA_LB_GPUTPCCFStreamCompaction_scanDown GPUCA_LB_SCAN
506+
#define GPUCA_LB_GPUTPCCFStreamCompaction_compactDigits GPUCA_LB_SCAN
506507
#define GPUCA_LB_GPUTPCCompressionGatherKernels_unbuffered GPUCA_LB_COMPRESSION_GATHER
507508
#define GPUCA_LB_GPUTPCCompressionGatherKernels_buffered32 GPUCA_LB_COMPRESSION_GATHER
508509
#define GPUCA_LB_GPUTPCCompressionGatherKernels_buffered64 GPUCA_LB_COMPRESSION_GATHER

GPU/GPUTracking/Standalone/tools/dumpGPUDefParam.C

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,21 @@
1313
/// \author David Rohr
1414

1515
// Run e.g. as:
16-
// ROOT_INCLUDE_PATH="`pwd`/include/GPU" root -l -q -b src/GPU/GPUTracking/Standalone/tools/dumpGPUDefParam.C'()'
16+
// ROOT_INCLUDE_PATH="`pwd`/include/GPU" root -l -q -b -DHEADER_TO_INCLUDE='"[PARAMETER_FILE].h"' src/GPU/GPUTracking/Standalone/tools/dumpGPUDefParam.C'()'
1717

18-
// Logic for testing to load the default parameters
19-
/* #define GPUCA_GPUCODE
20-
#define GPUCA_GPUTYPE_AMPERE
21-
#define GPUCA_MAXN 40
22-
#define GPUCA_ROW_COUNT 152
23-
#define GPUCA_TPC_COMP_CHUNK_SIZE 1024
24-
#include "GPUDefParametersConstants.h"
25-
#include "GPUDefParametersDefaults.h" */
18+
#ifndef PARAMETER_FILE
19+
#error Must provide the PARAMETER_FILE as preprocessor define, e.g. -DHEADER_TO_INCLUDE='"GPUDefParametersDefaults.h"'
20+
#endif
2621

27-
// Alternatively, logic to load file that sets GPUDefParameters
28-
#include "testParam.h"
22+
#define GPUCA_GPUCODE
23+
#include PARAMETER_FILE
2924

3025
#include "GPUDefParametersLoad.inc"
31-
void dumpGPUDefParam()
26+
void dumpGPUDefParam(const char* outputfile = "parameters.out")
3227
{
3328
auto param = o2::gpu::internal::GPUDefParametersLoad();
34-
printf("Loaded params:\n%s", o2::gpu::internal::GPUDefParametersExport(param, false).c_str());
35-
FILE* fp = fopen("parameters.out", "w+b");
29+
printf("Loaded params:\n%s\nWriting them to %s\n", o2::gpu::internal::GPUDefParametersExport(param, false).c_str(), outputfile);
30+
FILE* fp = fopen(outputfile, "w+b");
3631
fwrite(&param, 1, sizeof(param), fp);
3732
fclose(fp);
3833
}

0 commit comments

Comments
 (0)