-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* reverted deletion of reserve pool policies
* merged SimpleMalloc and CudaMalloc policies into AlpakaBuf policy * since the AlpakaBuf policy is stateful now, Allocator now contains an instance of the reserve pool policy
- Loading branch information
1 parent
739236e
commit f8a9d92
Showing
12 changed files
with
258 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
mallocMC: Memory Allocator for Many Core Architectures. | ||
https://www.hzdr.de/crp | ||
Copyright 2014 Institute of Radiation Physics, | ||
Helmholtz-Zentrum Dresden - Rossendorf | ||
Author(s): Carlchristian Eckert - c.eckert ( at ) hzdr.de | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "reservePoolPolicies/CudaSetLimits.hpp" | ||
#include "reservePoolPolicies/CudaSetLimits_impl.hpp" | ||
#include "reservePoolPolicies/AlpakaBuf.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
mallocMC: Memory Allocator for Many Core Architectures. | ||
Copyright 2020 Helmholtz-Zentrum Dresden - Rossendorf, | ||
CERN | ||
Author(s): Bernhard Manfred Gruber | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <alpaka/alpaka.hpp> | ||
#include <memory> | ||
#include <string> | ||
|
||
namespace mallocMC | ||
{ | ||
namespace ReservePoolPolicies | ||
{ | ||
template<typename AlpakaAcc> | ||
struct AlpakaBuf | ||
{ | ||
template<typename AlpakaDev> | ||
auto setMemPool(const AlpakaDev & dev, size_t memsize) -> void * | ||
{ | ||
poolBuffer = std::make_unique<PoolBufferType>( | ||
alpaka::mem::buf::alloc<unsigned char, size_t>( | ||
dev, memsize)); | ||
return alpaka::mem::view::getPtrNative(*poolBuffer); | ||
} | ||
|
||
void resetMemPool(void * p) | ||
{ | ||
poolBuffer = {}; | ||
} | ||
|
||
static auto classname() -> std::string | ||
{ | ||
return "AlpakaBuf"; | ||
} | ||
|
||
private: | ||
using PoolBufferType = alpaka::mem::buf::Buf< | ||
alpaka::dev::Dev<AlpakaAcc>, | ||
unsigned char, | ||
alpaka::dim::DimInt<1>, | ||
size_t>; | ||
std::unique_ptr<PoolBufferType> | ||
poolBuffer; // FIXME(bgruber): replace by std::optional<> | ||
}; | ||
} // namespace ReservePoolPolicies | ||
} // namespace mallocMC |
45 changes: 45 additions & 0 deletions
45
src/include/mallocMC/reservePoolPolicies/CudaSetLimits.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
mallocMC: Memory Allocator for Many Core Architectures. | ||
Copyright 2014 Institute of Radiation Physics, | ||
Helmholtz-Zentrum Dresden - Rossendorf | ||
Author(s): Carlchristian Eckert - c.eckert ( at ) hzdr.de | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
|
||
#pragma once | ||
|
||
namespace mallocMC | ||
{ | ||
namespace ReservePoolPolicies | ||
{ | ||
/** | ||
* @brief set CUDA internal heap for device-side malloc calls | ||
* | ||
* This ReservePoolPolicy is intended for use with CUDA capable | ||
* accelerators that support at least compute capability 2.0. It should | ||
* be used in conjunction with a CreationPolicy that actually requires | ||
* the CUDA-internal heap to be sized by calls to cudaDeviceSetLimit() | ||
*/ | ||
struct CudaSetLimits; | ||
|
||
} // namespace ReservePoolPolicies | ||
} // namespace mallocMC |
Oops, something went wrong.