Project
Loading...
Searching...
No Matches
CUDAThrustHelpers.h
Go to the documentation of this file.
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
14
15
#ifndef GPU_CUDATHRUSTHELPERS_H
16
#define GPU_CUDATHRUSTHELPERS_H
17
18
#include "
GPULogging.h
"
19
#include <vector>
20
#include <memory>
21
22
namespace
o2::gpu
23
{
24
25
class
ThrustVolatileAsyncAllocator
26
{
27
public
:
28
typedef
char
value_type
;
29
30
ThrustVolatileAsyncAllocator
(
GPUReconstruction
*
r
) : mRec(
r
) {}
31
char
*
allocate
(std::ptrdiff_t
n
) {
return
(
char
*)mRec->
AllocateVolatileDeviceMemory
(
n
); }
32
33
void
deallocate
(
char
*
ptr
,
size_t
) {}
34
35
private
:
36
GPUReconstruction
* mRec;
37
};
38
39
}
// namespace o2::gpu
40
41
#ifndef __HIPCC__
42
// Override synchronize call at end of thrust algorithm running on stream, just don't run cudaStreamSynchronize
43
namespace
thrust::cuda_cub
44
{
45
46
typedef
thrust::cuda_cub::execution_policy<typeof(thrust::cuda::par(*(
o2::gpu::ThrustVolatileAsyncAllocator
*)
nullptr
).on(*(cudaStream_t*)
nullptr
))> thrustStreamPolicy;
47
template
<>
48
__host__ __device__
inline
cudaError_t synchronize<thrustStreamPolicy>(thrustStreamPolicy& policy)
49
{
50
#ifndef GPUCA_GPUCODE_DEVICE
51
// Do not synchronize!
52
return
cudaSuccess;
53
#else
54
return
synchronize_stream(derived_cast(policy));
55
#endif
56
}
57
58
}
// namespace thrust::cuda_cub
59
#endif
// __HIPCC__
60
61
#endif
// GPU_CUDATHRUSTHELPERS_H
GPULogging.h
ptr
TBranch * ptr
Definition
TTreePlugin.cxx:832
o2::gpu::GPUReconstruction
Definition
GPUReconstruction.h:59
o2::gpu::GPUReconstruction::AllocateVolatileDeviceMemory
void * AllocateVolatileDeviceMemory(size_t size)
Definition
GPUReconstruction.cxx:702
o2::gpu::ThrustVolatileAsyncAllocator
Definition
CUDAThrustHelpers.h:26
o2::gpu::ThrustVolatileAsyncAllocator::allocate
char * allocate(std::ptrdiff_t n)
Definition
CUDAThrustHelpers.h:31
o2::gpu::ThrustVolatileAsyncAllocator::deallocate
void deallocate(char *ptr, size_t)
Definition
CUDAThrustHelpers.h:33
o2::gpu::ThrustVolatileAsyncAllocator::value_type
char value_type
Definition
CUDAThrustHelpers.h:28
o2::gpu::ThrustVolatileAsyncAllocator::ThrustVolatileAsyncAllocator
ThrustVolatileAsyncAllocator(GPUReconstruction *r)
Definition
CUDAThrustHelpers.h:30
n
GLdouble n
Definition
glcorearb.h:1982
r
GLboolean r
Definition
glcorearb.h:1233
o2::gpu
Definition
TrackTRD.h:35
thrust::cuda_cub
Definition
CUDAThrustHelpers.h:44
GPU
GPUTracking
Base
cuda
CUDAThrustHelpers.h
Generated on Tue Feb 25 2025 22:51:07 for Project by
1.9.8