Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
CudaInterface.cu
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Author:
4 * Jonas Rembser, CERN 2023
5 *
6 * Copyright (c) 2023, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13#include "CudaInterface.h"
14
15namespace RooBatchCompute {
16namespace CudaInterface {
17
18DeviceMemory::DeviceMemory(std::size_t n, std::size_t typeSize) : _size{n}
19{
20 void *ret;
22 _data.reset(ret);
23}
24PinnedHostMemory::PinnedHostMemory(std::size_t n, std::size_t typeSize) : _size{n}
25{
26 void *ret;
28 _data.reset(ret);
29}
30
31template <>
33{
34 ERRCHECK(::cudaFree(ptr));
35 ptr = nullptr;
36}
37template <>
39{
41 ptr = nullptr;
42}
43
44template <>
46{
47 auto stream = reinterpret_cast<cudaStream_t *>(ptr);
49 delete stream;
50 ptr = nullptr;
51}
52
53/**
54 * Creates a new CUDA stream.
55 *
56 * @return CudaStream object representing the new stream.
57 */
58CudaStream::CudaStream()
59{
60 auto stream = new cudaStream_t;
62 _ptr.reset(stream);
63}
64
65/// \cond ROOFIT_INTERNAL
66
67void copyHostToDeviceImpl(const void *src, void *dest, size_t nBytes, CudaStream *stream)
68{
69 if (stream)
71 else
73}
74
75void copyDeviceToHostImpl(const void *src, void *dest, size_t nBytes, CudaStream *stream)
76{
77 if (stream)
79 else
81}
82
83void copyDeviceToDeviceImpl(const void *src, void *dest, size_t nBytes, CudaStream *stream)
84{
85 if (stream)
87 else
89}
90
91/// \endcond
92
93} // namespace CudaInterface
94} // namespace RooBatchCompute
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
const Int_t n
Definition legend1.C:16
Namespace for dispatching RooFit computations to various backends.