Skip to content

Commit 37a1238

Browse files
mconcasdavidrohr
authored andcommitted
Make DCAFitterN.h GPU-compliant at sight
1 parent 7a6665b commit 37a1238

10 files changed

Lines changed: 330 additions & 176 deletions

File tree

Common/DCAFitter/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ o2_add_test(
4040
LABELS vertexing
4141
ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage
4242
VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/${CMAKE_INSTALL_DATADIR})
43+
44+
add_subdirectory(GPU)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
# All rights not expressly granted are reserved.
4+
#
5+
# This software is distributed under the terms of the GNU General Public
6+
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
#
8+
# In applying this license CERN does not waive the privileges and immunities
9+
# granted to it by virtue of its status as an Intergovernmental Organization
10+
# or submit itself to any jurisdiction.
11+
12+
if(CUDA_ENABLED)
13+
# o2_add_library(DCAFitterCUDA
14+
# TARGETVARNAME targetName
15+
# SOURCES DCAFitterN.cu
16+
# # src/FwdDCAFitterN.cxx
17+
# PUBLIC_INCLUDE_DIRECTORIES ../include
18+
# PUBLIC_LINK_LIBRARIES O2::MathUtils
19+
# O2::ReconstructionDataFormats
20+
# O2::DetectorsBase)
21+
22+
# o2_add_test(DCAFitterNCUDA NAME testDCAFitterNCUDA
23+
# SOURCES test/testDCAFitterNCUDA.cu
24+
# COMPONENT_NAME DCAFitterCUDA
25+
# PUBLIC_LINK_LIBRARIES O2::DCAFitter
26+
# COMPONENT_NAME GPU
27+
# LABELS gpu vertexing)
28+
endif()
29+
# if (HIP_ENABLED)
30+
# o2_add_test(DCAFitterNHIP NAME testDCAFitterNHIP
31+
# SOURCES test/testDCAFitterNCUDA.cu
32+
# HIPIFIED test
33+
# PUBLIC_LINK_LIBRARIES O2::DCAFitterHIP
34+
# COMPONENT_NAME GPU
35+
# LABELS gpu vertexing)
36+
# endif()

Common/DCAFitter/GPU/DCAFitterN.cu

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifdef __HIPCC__
13+
#include "hip/hip_runtime.h"
14+
#else
15+
#include <cuda.h>
16+
#endif
17+
18+
#include "GPUCommonDef.h"
19+
#include "DCAFitter/DCAFitterN.h"
20+
21+
namespace o2
22+
{
23+
namespace vertexing
24+
{
25+
GPUg() void __dummy_instance__()
26+
{
27+
#ifdef GPUCA_GPUCODE_DEVICE
28+
#pragma message "Compiling device code"
29+
#endif
30+
DCAFitter2 ft2;
31+
DCAFitter3 ft3;
32+
o2::track::TrackParCov tr;
33+
ft2.process(tr, tr);
34+
ft3.process(tr, tr, tr);
35+
}
36+
37+
} // namespace vertexing
38+
} // namespace o2
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
//
12+
/// \author matteo.concas@cern.ch
13+
#define BOOST_TEST_MODULE Test DCAFitterN class on GPU
14+
15+
#ifdef __HIPCC__
16+
#define GPUPLATFORM "HIP"
17+
#include "hip/hip_runtime.h"
18+
#else
19+
#define GPUPLATFORM "CUDA"
20+
#include <cuda.h>
21+
#endif
22+
23+
#include "DCAFitter/DCAFitterN.h"
24+
#include "GPUCommonDef.h"
25+
#include <boost/test/unit_test.hpp>
26+
27+
namespace gpu
28+
{
29+
GPUg() void testDCAFitterInstanceKernel()
30+
{
31+
o2::vertexing::DCAFitterN<2> ft; // 2 prong fitter
32+
ft.setBz(0.f);
33+
}
34+
} // namespace gpu
35+
BOOST_AUTO_TEST_CASE(DCAFitterNProngs)
36+
{
37+
}

0 commit comments

Comments
 (0)