Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
MemoryManager.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file MemoryManager.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2020 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#pragma once
10
11
// System include(s).
12
#include <cstddef>
13
#include <vector>
14
15
namespace
Acts {
16
namespace
Cuda {
17
36
class
MemoryManager
{
37
public
:
39
~MemoryManager
();
40
43
45
MemoryManager
(
const
MemoryManager
&) =
delete
;
47
MemoryManager
(
MemoryManager
&&) =
delete
;
48
50
MemoryManager
&
operator=
(
const
MemoryManager
&) =
delete
;
52
MemoryManager
&
operator=
(
MemoryManager
&&) =
delete
;
53
55
58
60
static
MemoryManager
&
instance
();
61
63
void
setMemorySize
(std::size_t sizeInBytes,
int
device = -1);
64
66
69
71
std::size_t
availableMemory
(
int
device = -1)
const
;
72
74
void
*
allocate
(std::size_t sizeInBytes,
int
device = -1);
75
77
void
reset
(
int
device = -1);
78
80
81
private
:
83
MemoryManager
();
84
87
struct
DeviceMemory
{
89
std::size_t
m_size
= 0;
91
char
*
m_ptr
=
nullptr
;
93
char
*
m_nextAllocation
=
nullptr
;
95
std::ptrdiff_t
m_maxUsage
= 0;
96
};
97
99
std::vector<DeviceMemory>
m_memory
;
100
101
};
// class MemoryManager
102
103
}
// namespace Cuda
104
}
// namespace Acts
acts
blob
sPHENIX
Plugins
Cuda
include
Acts
Plugins
Cuda
Utilities
MemoryManager.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:41
using
1.8.2 with
sPHENIX GitHub integration