Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Make code compatible with LSTCore structure #395

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ROCMINCLUDE = -I${ROCM_ROOT}/include
ALPAKA_CPU = -DALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
ALPAKA_CUDA = -DALPAKA_ACC_GPU_CUDA_ENABLED -DALPAKA_HOST_ONLY
ALPAKA_ROCM = -DALPAKA_ACC_GPU_HIP_ENABLED -DALPAKA_HOST_ONLY -DALPAKA_DISABLE_VENDOR_RNG -D__HIP_PLATFORM_HCC__ -D__HIP_PLATFORM_AMD__
EXTRAFLAGS = -ITMultiDrawTreePlayer -Wunused-variable -lTMVA -lEG -lGenVector -lXMLIO -lMLP -lTreePlayer -fopenmp
EXTRAFLAGS = -ITMultiDrawTreePlayer -Wunused-variable -lTMVA -lEG -lGenVector -lXMLIO -lMLP -lTreePlayer -fopenmp -DLST_STANDALONE
DOQUINTUPLET =
PTCUTFLAG =
CUTVALUEFLAG =
Expand Down
4 changes: 4 additions & 0 deletions SDL/EndcapGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include <vector>
#include <stdexcept>

#ifdef LST_STANDALONE
#include "Constants.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#endif

#include "HeterogeneousCore/AlpakaInterface/interface/host.h"

Expand Down
14 changes: 9 additions & 5 deletions SDL/Event.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#ifndef Event_cuh
#define Event_cuh

#include "Hit.h"
#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "Hit.h"
#include "ModuleMethods.h"
#include "Segment.h"
#include "Triplet.h"
Expand All @@ -11,7 +18,6 @@
#include "MiniDoublet.h"
#include "PixelTriplet.h"
#include "TrackCandidate.h"
#include "Constants.h"

#include "HeterogeneousCore/AlpakaInterface/interface/host.h"

Expand Down Expand Up @@ -179,9 +185,7 @@ namespace SDL {
modulesBuffer<alpaka::DevCpu>* getModules(bool isFull = false);

//read from file and init
static void initModules(QueueAcc& queue,
const MapPLStoLayer& pLStoLayer,
const char* moduleMetaDataFilePath);
static void initModules(QueueAcc& queue, const MapPLStoLayer& pLStoLayer, const char* moduleMetaDataFilePath);
};

} // namespace SDL
Expand Down
6 changes: 6 additions & 0 deletions SDL/Globals.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#ifndef Globals_h
#define Globals_h

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "TiltedGeometry.h"
#include "EndcapGeometry.h"
#include "ModuleConnectionMap.h"
Expand Down
5 changes: 5 additions & 0 deletions SDL/Hit.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#ifndef Hit_cuh
#define Hit_cuh

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

namespace SDL {
struct hits {
Expand Down
8 changes: 7 additions & 1 deletion SDL/Kernels.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#ifndef Kernels_cuh
#define Kernels_cuh

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "Hit.h"
#include "MiniDoublet.h"
#include "Segment.h"
#include "Triplet.h"
#include "Quintuplet.h"
#include "PixelTriplet.h"
#include "Constants.h"

namespace SDL {
ALPAKA_FN_ACC ALPAKA_FN_INLINE void rmQuintupletFromMemory(struct SDL::quintuplets& quintupletsInGPU,
Expand Down
17 changes: 16 additions & 1 deletion SDL/LST.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
#ifdef LST_STANDALONE
#include "LST.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/LST.h"
#endif

#include "Event.h"
#include "Globals.h"

#include "Math/Vector3D.h"
using XYZVector = ROOT::Math::XYZVector;

namespace {
std::string trackLooperDir() { return getenv("LST_BASE"); }
std::string trackLooperDir() {
const char* path = getenv("LST_BASE");
std::string path_str;
if (path != nullptr) {
path_str = path;
} else {
path_str = getenv("CMSSW_BASE");
ariostas marked this conversation as resolved.
Show resolved Hide resolved
path_str += "/src/RecoTracker/LSTCore/TrackLooper";
}
return path_str;
}

std::string get_absolute_path_after_check_file_exists(const std::string name) {
std::filesystem::path fullpath = std::filesystem::absolute(name.c_str());
Expand Down
4 changes: 4 additions & 0 deletions SDL/LST.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#ifndef LST_H
#define LST_H

#ifdef LST_STANDALONE
#include "Constants.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#endif

#include <filesystem>
#include <cstdlib>
Expand Down
6 changes: 3 additions & 3 deletions SDL/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ LIBS=$(LIB_CPU) $(LIB_CUDA) $(LIB_ROCM)
GENCODE_CUDA := -gencode arch=compute_70,code=[sm_70,compute_70] -gencode arch=compute_89,code=[sm_89,compute_89]

CXX = g++
CXXFLAGS_CPU = -march=native -mtune=native -Ofast -fno-reciprocal-math -fopenmp-simd -g -Wall -Wshadow -Woverloaded-virtual -fPIC -fopenmp -I..
CXXFLAGS_CUDA = -O3 -g --compiler-options -Wall --compiler-options -Wshadow --compiler-options -Woverloaded-virtual --compiler-options -fPIC --compiler-options -fopenmp -dc -lineinfo --ptxas-options=-v --cudart shared $(GENCODE_CUDA) --use_fast_math --default-stream per-thread -I..
CXXFLAGS_ROCM = -O3 -g -Wall -Wshadow -Woverloaded-virtual -fPIC -I${ROCM_ROOT}/include -I..
CXXFLAGS_CPU = -march=native -mtune=native -Ofast -fno-reciprocal-math -fopenmp-simd -g -Wall -Wshadow -Woverloaded-virtual -fPIC -fopenmp -DLST_STANDALONE -I..
CXXFLAGS_CUDA = -O3 -g --compiler-options -Wall --compiler-options -Wshadow --compiler-options -Woverloaded-virtual --compiler-options -fPIC --compiler-options -fopenmp -dc -lineinfo --ptxas-options=-v --cudart shared $(GENCODE_CUDA) --use_fast_math --default-stream per-thread -DLST_STANDALONE -I..
CXXFLAGS_ROCM = -O3 -g -Wall -Wshadow -Woverloaded-virtual -fPIC -I${ROCM_ROOT}/include -DLST_STANDALONE -I..
CMSSWINCLUDE := -I${CMSSW_BASE}/src
ifdef CMSSW_RELEASE_BASE
CMSSWINCLUDE := ${CMSSWINCLUDE} -I${CMSSW_RELEASE_BASE}/src
Expand Down
8 changes: 7 additions & 1 deletion SDL/MiniDoublet.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#ifndef MiniDoublet_cuh
#define MiniDoublet_cuh

#ifdef LST_STANDALONE
#include "Constants.h"
#include "EndcapGeometry.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "EndcapGeometry.h"
#include "Hit.h"

namespace SDL {
Expand Down
5 changes: 5 additions & 0 deletions SDL/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
#define Module_cuh

#include <alpaka/alpaka.hpp>

#ifdef LST_STANDALONE
#include "Constants.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#endif

namespace SDL {
enum SubDet { InnerPixel = 0, Barrel = 5, Endcap = 4 };
Expand Down
4 changes: 4 additions & 0 deletions SDL/ModuleConnectionMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
#include <sstream>
#include <algorithm>

#ifdef LST_STANDALONE
#include "Constants.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#endif

namespace SDL {
//FIXME: move to non-alpaka single arch build
Expand Down
6 changes: 6 additions & 0 deletions SDL/ModuleMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
#include <map>
#include <iostream>

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "TiltedGeometry.h"
#include "EndcapGeometry.h"
#include "ModuleConnectionMap.h"
Expand Down
8 changes: 7 additions & 1 deletion SDL/NeuralNetwork.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#ifndef NeuralNetwork_cuh
#define NeuralNetwork_cuh

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "NeuralNetworkWeights.h"
#include "Segment.h"
#include "MiniDoublet.h"
#include "Module.h"
#include "Hit.h"
#include "Triplet.h"

Expand Down
4 changes: 4 additions & 0 deletions SDL/PixelMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
#include <vector>
#include <cstdint>

#ifdef LST_STANDALONE
#include "Constants.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#endif

namespace SDL {
// PixelMap is never allocated on the device.
Expand Down
16 changes: 14 additions & 2 deletions SDL/PixelTriplet.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#ifndef PixelTriplet_cuh
#define PixelTriplet_cuh

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "Triplet.h"
#include "Segment.h"
#include "MiniDoublet.h"
#include "Module.h"
#include "Hit.h"
#include "Quintuplet.h"

Expand Down Expand Up @@ -1878,10 +1884,16 @@ namespace SDL {
#ifndef PixelQuintuplet_cuh
#define PixelQuintuplet_cuh

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "Segment.h"
#include "MiniDoublet.h"
#include "Module.h"
#include "Hit.h"
#include "Triplet.h"
#include "Quintuplet.h"
Expand Down
8 changes: 7 additions & 1 deletion SDL/Quintuplet.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#ifndef Quintuplet_cuh
#define Quintuplet_cuh

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "NeuralNetwork.h"
#include "EndcapGeometry.h"
#include "Segment.h"
#include "MiniDoublet.h"
#include "Module.h"
#include "Hit.h"
#include "Triplet.h"

Expand Down
8 changes: 7 additions & 1 deletion SDL/Segment.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#ifndef Segment_cuh
#define Segment_cuh

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "EndcapGeometry.h"
#include "MiniDoublet.h"
#include "Module.h"
#include "Hit.h"

namespace SDL {
Expand Down
4 changes: 4 additions & 0 deletions SDL/TiltedGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include <string>
#include <stdexcept>

#ifdef LST_STANDALONE
#include "Constants.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#endif

namespace SDL {
template <typename>
Expand Down
8 changes: 7 additions & 1 deletion SDL/TrackCandidate.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#ifndef TrackCandidate_cuh
#define TrackCandidate_cuh

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "Triplet.h"
#include "Segment.h"
#include "MiniDoublet.h"
#include "PixelTriplet.h"
#include "Quintuplet.h"
#include "Module.h"
#include "Hit.h"

namespace SDL {
Expand Down
8 changes: 7 additions & 1 deletion SDL/Triplet.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#ifndef Triplet_cuh
#define Triplet_cuh

#ifdef LST_STANDALONE
#include "Constants.h"
#include "Module.h"
#else
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#endif

#include "Segment.h"
#include "MiniDoublet.h"
#include "Module.h"
#include "Hit.h"

namespace SDL {
Expand Down