Skip to content

Commit

Permalink
renamed scatteralloc/policymalloc to mallocMC
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlchristian Eckert committed May 28, 2014
1 parent 6eb9b07 commit 7ceabcc
Show file tree
Hide file tree
Showing 45 changed files with 420 additions and 688 deletions.
22 changes: 9 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(ScatterAlloc)
project(mallocMC)
cmake_minimum_required(VERSION 2.8.5)

# helper for libs and packages
Expand Down Expand Up @@ -48,29 +48,25 @@ INSTALL(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/include/."
DESTINATION include
PATTERN ".git" EXCLUDE
PATTERN "policy_malloc_config.hpp" EXCLUDE
PATTERN "mallocMC_config.hpp" EXCLUDE
)


###############################################################################
# Executables
###############################################################################
add_custom_target(examples DEPENDS PolicyAllocExample01 PolicyAllocExample02 VerifyHeap)
add_custom_target(examples DEPENDS mallocMC_Example01 mallocMC_Example02 VerifyHeap)

cuda_add_executable(PolicyAllocExample
cuda_add_executable(mallocMC_Example01
EXCLUDE_FROM_ALL
examples/policy_example.cu )
cuda_add_executable(PolicyAllocExample01
examples/mallocMC_example01.cu )
cuda_add_executable(mallocMC_Example02
EXCLUDE_FROM_ALL
examples/policy_example01.cu )
cuda_add_executable(PolicyAllocExample02
EXCLUDE_FROM_ALL
examples/policy_example02.cu )
examples/mallocMC_example02.cu )
cuda_add_executable(VerifyHeap
EXCLUDE_FROM_ALL
tests/verify_heap.cu )

target_link_libraries(PolicyAllocExample ${LIBS})
target_link_libraries(PolicyAllocExample01 ${LIBS})
target_link_libraries(PolicyAllocExample02 ${LIBS})
target_link_libraries(mallocMC_Example01 ${LIBS})
target_link_libraries(mallocMC_Example02 ${LIBS})
target_link_libraries(VerifyHeap ${LIBS})
16 changes: 8 additions & 8 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ Install
- `BOOST_ROOT`: Boost installation directory, e.g. `export BOOST_ROOT=<BOOST_INSTALL>`

### Examples
This is an example how to compile `scatteralloc` and test the example code snippets
This is an example how to compile `mallocMC` and test the example code snippets

1. **Setup directories:**
- `mkdir ~/scatteralloc ~/scatterallocBuild`
- `mkdir -p build`
2. **Download the source code:**
- `git clone https://github.com/ComputationalRadiationPhysics/scatteralloc.git ~/scatteralloc`
- `git clone https://github.com/ComputationalRadiationPhysics/mallocMC.git`
3. **Build**
- `cd ~/scatterallocBuild`
- `cmake ../scatteralloc -DCMAKE_INSTALL_PREFIX=$HOME/libs`
- `make`
- `cd build`
- `cmake ../mallocMC -DCMAKE_INSTALL_PREFIX=$HOME/libs`
- `make examples`
- `make install` (optional)
4. **Run the examples**
- `./PolicyAllocExample01`
- `./PolicyAllocExample02`
- `./mallocMC_Example01`
- `./mallocMC_Example02`
- `./VerifyHeap`
- additional options: see `./VerifyHeap --help`
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
ScatterAlloc: Massively Parallel Dynamic Memory Allocation for the GPU.
mallocMC: Memory Allocation for Many Core Architecture
http://www.icg.tugraz.at/project/mvp
https://www.hzdr.de/crp

Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
ScatterAlloc
============
mallocMC
=============

ScatterAlloc: Massively Parallel Dynamic Memory Allocation for the GPU
mallocMC: Memory Allocator for Many Core Architectures

This project provides a **fast memory manager** for **Nvidia GPUs** with
compute capability `sm_20` or higher.
This project provides a framework for **fast memory managers** on **many core
accelerators**. Currently, it supports **NVIDIA GPUs** of compute capability
`sm_20` or higher through the ScatterAlloc algorithm.

From http://www.icg.tugraz.at/project/mvp/downloads :
```quote
Expand All @@ -28,7 +29,7 @@ Our Homepage: https://www.hzdr.de/crp
About This Repository
---------------------

This repository is a
The currently implemented algorithm is a
[fork](https://en.wikipedia.org/wiki/Fork_%28software_development%29)
of the **ScatterAlloc** project from the
[Managed Volume Processing](http://www.icg.tugraz.at/project/mvp)
Expand Down
42 changes: 21 additions & 21 deletions Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Step 1: include
There is one header file that will include *all* necessary files:

```c++
#include <scatteralloc/scatteralloc.hpp>
#include <mallocMC/mallocMC.hpp>
```

Step 2a: choose policies
Expand Down Expand Up @@ -44,7 +44,7 @@ to the policy class:

```c++
// configure the AlignmentPolicy "Shrink"
struct ShrinkConfig : PolicyMalloc::AlignmentPolicies::Shrink<>::Properties {
struct ShrinkConfig : mallocMC::AlignmentPolicies::Shrink<>::Properties {
typedef boost::mpl::int_<16> dataAlignment;
};
```
Expand All @@ -55,9 +55,9 @@ After configuring the chosen policies, they can be used as template
parameters to create the desired allocator type:
```c++
using namespace PolicyMalloc;
using namespace mallocMC;
typedef PolicyAllocator<
typedef mallocMC::Allocator<
CreationPolicy::OldMalloc,
DistributionPolicy::Noop,
OOMPolicy::ReturnNull,
Expand All @@ -71,9 +71,9 @@ from NVIDIA CUDA since compute capability sm_20. To get a more novel allocator,
could create the following typedef instead:

```c++
using namespace PolicyMalloc;
using namespace mallocMC;

typedef PolicyAllocator<
typedef mallocMC::Allocator<
CreationPolicies::Scatter<>,
DistributionPolicies::XMallocSIMD<>,
OOMPolicies::ReturnNull,
Expand All @@ -97,15 +97,15 @@ functions, the following Macro has to be executed:
POLICYMALLOC_SET_ALLOCATOR_TYPE(ScatterAllocator)
```
This will set up the following functions in the namespace `PolicyMalloc`:
This will set up the following functions in the namespace `mallocMC`:
| Name | description |
|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| InitHeap() | Initializes the heap. Must be called before any other calls to the allocator are permitted. Can take the desired size of the heap as a parameter |
| finalizeHeap() | Destroys the heap again |
| pbMalloc() / malloc() | Allocates memory on the accelerator |
| pbFree() / free() | Frees memory on the accelerator |
| getAvailableSlots() | Determines number of allocatable slots of a certain size. This only works, if the chose CreationPolicy supports it (can be found through `PolicyMalloc::Traits<ScatterAllocator>::providesAvailableSlots`) |
| getAvailableSlots() | Determines number of allocatable slots of a certain size. This only works, if the chose CreationPolicy supports it (can be found through `mallocMC::Traits<ScatterAllocator>::providesAvailableSlots`) |
If the policy class `OldMalloc` is **not** used, it is also possible to execute
the Macro
Expand All @@ -121,37 +121,37 @@ Step 4: use dynamic memory allocation
-------------------------------------
A simplistic example would look like this:
```c++
#include <scatteralloc/scatteralloc.hpp>
#include <mallocMC/mallocMC.hpp>

namespace PolicyMalloc = PM;
namespace mallocMC = MC;

typedef PM::PolicyAllocator<
PM::CreationPolicies::Scatter<>,
PM::DistributionPolicies::XMallocSIMD<>,
PM::OOMPolicies::ReturnNull,
PM::ReservePoolPolicies::SimpleCudaMalloc,
PM::AlignmentPolicies::Shrink<ShrinkConfig>
typedef MC::Allocator<
MC::CreationPolicies::Scatter<>,
MC::DistributionPolicies::XMallocSIMD<>,
MC::OOMPolicies::ReturnNull,
MC::ReservePoolPolicies::SimpleCudaMalloc,
MC::AlignmentPolicies::Shrink<ShrinkConfig>
> ScatterAllocator;
POLICYMALLOC_SET_ALLOCATOR_TYPE(ScatterAllocator)
MALLOCMC_SET_ALLOCATOR_TYPE(ScatterAllocator)

__global__ exampleKernel()
{
// some code ...

int* a = (int*) PM::malloc(sizeof(int)*42);
int* a = (int*) MC::malloc(sizeof(int)*42);

// some more code, using *a

PM::free(a);
MC::free(a);
}

int main(){
PM::initHeap(512); // heapsize of 512MB
MC::initHeap(512); // heapsize of 512MB

exampleKernel<<<32,32>>>();

PM::finalizeHeap();
MC::finalizeHeap();
return 0;
}
```
132 changes: 0 additions & 132 deletions examples/example.cu

This file was deleted.

Loading

0 comments on commit 7ceabcc

Please sign in to comment.