Skip to content

Commit

Permalink
Add more configuration options and dependency path autoconfiguration …
Browse files Browse the repository at this point in the history
…for GPU Tracking Standalone build
  • Loading branch information
davidrohr committed Aug 1, 2019
1 parent 5a6c9e4 commit f0fb2e8
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 90 deletions.
2 changes: 1 addition & 1 deletion GPU/Common/GPULogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define GPUWarning(...)
#define GPUError(...)
#define GPUFatal(...)
#elif defined(GPUCA_STANDALONE) && !defined(GPUCA_GPUCODE_DEVICE)
#elif defined(GPUCA_STANDALONE) && !defined(GPUCA_GPUCODE_DEVICE) && !defined(GPUCA_NO_FMT)
#include <fmt/printf.h>
#define GPUInfo(string, ...) \
{ \
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/Base/opencl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ add_custom_command(
# cmake-format: off
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.S
COMMAND cat ${GPUDIR}/Standalone/makefiles/include.S | sed "s/FILENAMEMOD/_makefile_opencl_program_Base_opencl_GPUReconstructionOCL1_cl/g" | sed "s/FILENAMENORMAL/GPUReconstructionOCL1Code.bin/g" > ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.S
COMMAND cat ${GPUDIR}/Standalone/makefiles/include.S | sed "s/FILENAMEMOD/_makefile_opencl_program_Base_opencl_common_GPUReconstructionOCL_cl/g" | sed "s/FILENAMENORMAL/GPUReconstructionOCL1Code.bin/g" > ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.S
MAIN_DEPENDENCY ${GPUDIR}/Standalone/makefiles/include.S
)
# cmake-format: on
Expand Down
4 changes: 2 additions & 2 deletions GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using namespace GPUCA_NAMESPACE::gpu;
#include <cstdlib>

#include "../makefiles/opencl_obtain_program.h"
extern "C" char _makefile_opencl_program_Base_opencl_GPUReconstructionOCL1_cl[];
extern "C" char _makefile_opencl_program_Base_opencl_common_GPUReconstructionOCL_cl[];

GPUReconstruction* GPUReconstruction_Create_OCL(const GPUSettingsProcessing& cfg) { return new GPUReconstructionOCL1(cfg); }

Expand Down Expand Up @@ -68,7 +68,7 @@ int GPUReconstructionOCL1Backend::GetOCLPrograms()
return (1);
}

if (_makefiles_opencl_obtain_program_helper(mInternals->context, count, mInternals->devices.get(), &mInternals->program, _makefile_opencl_program_Base_opencl_GPUReconstructionOCL1_cl)) {
if (_makefiles_opencl_obtain_program_helper(mInternals->context, count, mInternals->devices.get(), &mInternals->program, _makefile_opencl_program_Base_opencl_common_GPUReconstructionOCL_cl)) {
clReleaseContext(mInternals->context);
GPUError("Could not obtain OpenCL progarm");
return 1;
Expand Down
88 changes: 52 additions & 36 deletions GPU/GPUTracking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ else()
AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(GPUCA_EVENT_DISPLAY ON)
endif()
set(GPUCA_QA ON)
if(ROOT_FOUND)
set(GPUCA_QA ON)
endif()
endif()

# General sources
set(SRCS
SliceTracker/GPUTPCTrack.cxx
SliceTracker/GPUTPCBaseTrackParam.cxx
Expand Down Expand Up @@ -112,6 +115,46 @@ set(HDRS_INSTALL
dEdx/GPUdEdxInfo.h
)

# Sources only for O2
if(ALIGPU_BUILD_TYPE STREQUAL "O2")
set(SRCS ${SRCS} Interface/GPUO2Interface.cxx)
set(HDRS_CINT_O2 ${HDRS_CINT_O2} Interface/GPUO2Interface.h)
endif()

# Sources for O2 and for Standalone if requested in config file
if(ALIGPU_BUILD_TYPE STREQUAL "O2" OR CONFIG_ROOT_AND_O2_EXTENSIONS)
set(SRCS_NO_CINT
${SRCS_NO_CINT}
Standalone/display/GPUDisplayBackend.cxx
Global/GPUChainITS.cxx
ITS/GPUITSFitter.cxx
ITS/GPUITSFitterKernels.cxx
dEdx/GPUdEdx.cxx
TPCConvert/GPUTPCConvert.cxx
TPCConvert/GPUTPCConvertKernel.cxx
DataCompression/GPUTPCCompression.cxx
DataCompression/GPUTPCCompressionTrackModel.cxx
DataCompression/GPUTPCCompressionKernels.cxx
DataCompression/TPCClusterDecompressor.cxx
DataCompression/GPUTPCClusterStatistics.cxx)
set(HDRS_INSTALL ${HDRS_INSTALL} Interface/GPUO2InterfaceConfiguration.h
ITS/GPUITSTrack.h dEdx/GPUdEdxInfo.h)
else()
set(HDRS_INSTALL
${HDRS_INSTALL}
ITS/GPUITSFitter.h
ITS/GPUITSFitterKernels.h
ITS/GPUITSTrack.h
TPCConvert/GPUTPCConvert.h
TPCConvert/GPUTPCConvertKernel.h
DataCompression/GPUTPCCompression.h
DataCompression/GPUTPCCompressionTrackModel.h
DataCompression/GPUTPCCompressionKernels.h
DataCompression/TPCClusterDecompressor.h
DataCompression/GPUTPCClusterStatistics.h)
endif()

# Sources only for AliRoot
if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT")
set(SRCS
${SRCS}
Expand All @@ -129,43 +172,10 @@ if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT")
${CMAKE_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCDefinitions.cxx
${CMAKE_SOURCE_DIR}/HLT/TRD/AliHLTTRDDefinitions.cxx)

set(HDRS_INSTALL
${HDRS_INSTALL}
SliceTracker/GPUTPCDefinitions.h
ITS/GPUITSFitter.h
ITS/GPUITSFitterKernels.h
ITS/GPUITSTrack.h
TPCConvert/GPUTPCConvert.h
TPCConvert/GPUTPCConvertKernel.h
DataCompression/GPUTPCCompression.h
DataCompression/GPUTPCCompressionTrackModel.h
DataCompression/GPUTPCCompressionKernels.h
DataCompression/TPCClusterDecompressor.h
DataCompression/GPUTPCClusterStatistics.h)
else()
set(SRCS_NO_CINT
${SRCS_NO_CINT}
Standalone/display/GPUDisplayBackend.cxx
Global/GPUChainITS.cxx
ITS/GPUITSFitter.cxx
ITS/GPUITSFitterKernels.cxx
dEdx/GPUdEdx.cxx
TPCConvert/GPUTPCConvert.cxx
TPCConvert/GPUTPCConvertKernel.cxx
DataCompression/GPUTPCCompression.cxx
DataCompression/GPUTPCCompressionTrackModel.cxx
DataCompression/GPUTPCCompressionKernels.cxx
DataCompression/TPCClusterDecompressor.cxx
DataCompression/GPUTPCClusterStatistics.cxx)
set(HDRS_INSTALL ${HDRS_INSTALL} Interface/GPUO2InterfaceConfiguration.h
ITS/GPUITSTrack.h dEdx/GPUdEdxInfo.h)
endif()

if(ALIGPU_BUILD_TYPE STREQUAL "O2")
set(SRCS ${SRCS} Interface/GPUO2Interface.cxx)
set(HDRS_CINT_O2 ${HDRS_CINT_O2} Interface/GPUO2Interface.h)
set(HDRS_INSTALL ${HDRS_INSTALL} SliceTracker/GPUTPCDefinitions.h)
endif()

# Optional sources depending on optional dependencies
if(GPUCA_EVENT_DISPLAY)
set(SRCS_NO_CINT ${SRCS_NO_CINT} Standalone/utils/qsem.cxx
Standalone/display/GPUDisplay.cxx
Expand All @@ -187,11 +197,13 @@ if(GPUCA_EVENT_DISPLAY OR GPUCA_QA)
set(HDRS_INSTALL ${HDRS_INSTALL} Standalone/qconfigoptions.h)
endif()

# Update HDR variables with files derrived from SRC variables
string(REPLACE ".cxx" ".h" HDRS_CINT_ALIROOT "${SRCS}")
string(REPLACE ".cxx" ".h" HDRS_TMP "${SRCS_NO_CINT}")
set(HDRS_INSTALL ${HDRS_INSTALL} ${HDRS_TMP})
unset(HDRS_TMP)

# Main CMake part for O2
if(ALIGPU_BUILD_TYPE STREQUAL "O2")
o2_add_library(${MODULE}
TARGETVARNAME targetName
Expand Down Expand Up @@ -242,6 +254,7 @@ if(ALIGPU_BUILD_TYPE STREQUAL "O2")
FILES_MATCHING PATTERN *.h)
endif()

# Main CMake part for AliRoot
if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT")
set(HDRS_CINT_ALIROOT ${HDRS_CINT_ALIROOT}
Base/GPUO2DataTypes.h)
Expand Down Expand Up @@ -333,6 +346,7 @@ if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT")
add_library(O2::${MODULE} ALIAS Ali${MODULE})
endif()

# Main CMake part for Standalone
if(ALIGPU_BUILD_TYPE STREQUAL "Standalone")
add_library(${MODULE} SHARED ${SRCS} ${SRCS_NO_CINT} ${SRCS_NO_H})
set(targetName ${MODULE})
Expand All @@ -347,6 +361,7 @@ if(GPUCA_EVENT_DISPLAY)
OpenGL::GLU)
endif()

# Add compile definitions and libraries depending on available optional dependencies
if(GPUCA_QA)
message(STATUS "Building GPU QA")
target_compile_definitions(${targetName} PRIVATE GPUCA_BUILD_QA)
Expand All @@ -371,6 +386,7 @@ if(HIP_ENABLED)
target_compile_definitions(${targetName} PRIVATE HIP_ENABLED)
endif()

# Add CMake recipes for GPU Tracking librararies
if(CUDA_ENABLED OR OPENCL1_ENABLED OR OPENCL2_ENABLED OR HIP_ENABLED)
if(CMAKE_SYSTEM_NAME MATCHES Darwin)
message(WARNING "GPU Tracking disabled on MacOS")
Expand Down
5 changes: 4 additions & 1 deletion GPU/GPUTracking/SliceTracker/GPUTPCTrackletSelector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ GPUd() void GPUTPCTrackletSelector::Thread<0>(int nBlocks, int nThreads, int iBl
s.fHits[iThread][nHits].Set(irow, ih);
} else
#endif // GPUCA_TRACKLET_SELECTOR_HITS_REG_SIZE != 0
{
trackHits[nHits - GPUCA_TRACKLET_SELECTOR_HITS_REG_SIZE].Set(irow, ih);
}
nHits++;
if (!own) {
nShared++;
Expand Down Expand Up @@ -110,8 +112,9 @@ GPUd() void GPUTPCTrackletSelector::Thread<0>(int nBlocks, int nThreads, int iBl
tracker.TrackHits()[nFirstTrackHit + jh] = s.fHits[iThread][jh];
} else
#endif // GPUCA_TRACKLET_SELECTOR_HITS_REG_SIZE != 0

{
tracker.TrackHits()[nFirstTrackHit + jh] = trackHits[jh - GPUCA_TRACKLET_SELECTOR_HITS_REG_SIZE];
}
}
}
nHits = 0;
Expand Down
Loading

0 comments on commit f0fb2e8

Please sign in to comment.