From 41989b0354d8e8f3d7f5358f316551a5be49a25b Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 17 Feb 2015 17:57:39 +0100 Subject: [PATCH 01/17] Link to new Module Repo --- INSTALL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index bbe88223..c1f3c411 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -58,7 +58,7 @@ Because we are linking to Boost and CUDA, the following **external dependencies* If you are using CMake you can download our `FindmallocMC.cmake` module with ```bash -wget https://raw.githubusercontent.com/ComputationalRadiationPhysics/picongpu/dev/src/cmake/FindmallocMC.cmake +wget https://raw.githubusercontent.com/ComputationalRadiationPhysics/cmake-modules/dev/FindmallocMC.cmake # read the documentation cmake -DCMAKE_MODULE_PATH=. --help-module FindmallocMC | less ``` @@ -68,7 +68,7 @@ and use the following lines in your `CMakeLists.txt`: # this example will require at least CMake 2.8.5 cmake_minimum_required(VERSION 2.8.5) -# add path to FindmallocMC.cmake, e.g. in the directory in cmake/ +# add path to FindmallocMC.cmake, e.g., in the directory in cmake/ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/) # find the packages that are required by mallocMC. This has to be done BEFORE From 39b195aea2347d7e461d489787a1c1c1dbfc1bf3 Mon Sep 17 00:00:00 2001 From: Carlchristian Eckert Date: Thu, 28 May 2015 12:23:56 +0200 Subject: [PATCH 02/17] added host function to return heap pointer - use: std::vector mallocMC::getHeapLocations() - uses a vector, since future allocators might have more than 1 heap (and those are not necessarily located one after another) - currently, HeapInfo contains size and a pointer p - the pointer is the device address (as it would be returned my cudaMalloc for example) - the CUDA toolkit allocator will currently return NULL. Ideas very welcome. Problem: we have no pointer address for its internal heap (might be multiple heaps, who knows). Also, we don't know how objects are organized on the heap, so copying to host might be of limited value anyway. --- src/include/mallocMC/mallocMC_hostclass.hpp | 15 +++++++++++++++ src/include/mallocMC/mallocMC_overwrites.hpp | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/include/mallocMC/mallocMC_hostclass.hpp b/src/include/mallocMC/mallocMC_hostclass.hpp index b5282a36..3c28e765 100644 --- a/src/include/mallocMC/mallocMC_hostclass.hpp +++ b/src/include/mallocMC/mallocMC_hostclass.hpp @@ -57,6 +57,11 @@ namespace mallocMC{ static const bool providesAvailableSlots = T::CreationPolicy::providesAvailableSlots::value; }; + class HeapInfo{ + public: + void* p; + size_t size; + }; /** * @brief "HostClass" that combines all policies to a useful allocator @@ -96,6 +101,7 @@ namespace mallocMC{ private: typedef boost::uint32_t uint32; void* pool; + HeapInfo heapInfos; public: @@ -129,6 +135,8 @@ namespace mallocMC{ pool = ReservePoolPolicy::setMemPool(size); boost::tie(pool,size) = AlignmentPolicy::alignPool(pool,size); void* h = CreationPolicy::initHeap(*this,pool,size); + heapInfos.p=pool; + heapInfos.size=size; /* * This is a workaround for a bug with getAvailSlotsPoly: @@ -170,6 +178,13 @@ namespace mallocMC{ return getAvailSlotsPoly(slotSize, boost::mpl::bool_()); } + MAMC_HOST + std::vector getHeapLocations(){ + std::vector v; + v.push_back(heapInfos); + return v; + } + private: MAMC_HOST MAMC_ACCELERATOR unsigned getAvailSlotsPoly(size_t slotSize, boost::mpl::bool_){ diff --git a/src/include/mallocMC/mallocMC_overwrites.hpp b/src/include/mallocMC/mallocMC_overwrites.hpp index 24a71e9c..fb0edc41 100644 --- a/src/include/mallocMC/mallocMC_overwrites.hpp +++ b/src/include/mallocMC/mallocMC_overwrites.hpp @@ -103,6 +103,20 @@ void free(void* p) __THROW \ } /* end namespace mallocMC */ +/** Create the function getHeapLocations inside a namespace + * + * This returns a vector of type mallocMC::HeapInfo. The HeapInfo should at least + * contain the pointer to the heap (on device) and its size. + */ +#define MALLOCMC_HEAPLOC() \ +namespace mallocMC{ \ +MAMC_HOST \ +std::vector getHeapLocations() \ +{ \ + return mallocMC::mallocMCGlobalObject.getHeapLocations(); \ +} \ +} /* end namespace mallocMC */ + /* if the defines do not exist (wrong CUDA version etc), * create at least empty defines @@ -121,4 +135,5 @@ void free(void* p) __THROW \ #define MALLOCMC_SET_ALLOCATOR_TYPE(MALLOCMC_USER_DEFINED_TYPE) \ MALLOCMC_GLOBAL_FUNCTIONS(MALLOCMC_USER_DEFINED_TYPE) \ MALLOCMC_MALLOC() \ +MALLOCMC_HEAPLOC() \ MALLOCMC_AVAILABLESLOTS() From 84c8c20309633c98f69be83153eb897ce2d83110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Wed, 3 Jun 2015 13:57:28 +0200 Subject: [PATCH 03/17] fix broken compile - add typedef for `vector` in `mallocMC_hostclass` - add missing includes `` --- src/include/mallocMC/mallocMC_hostclass.hpp | 7 +++++-- src/include/mallocMC/mallocMC_overwrites.hpp | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/include/mallocMC/mallocMC_hostclass.hpp b/src/include/mallocMC/mallocMC_hostclass.hpp index 3c28e765..1c768305 100644 --- a/src/include/mallocMC/mallocMC_hostclass.hpp +++ b/src/include/mallocMC/mallocMC_hostclass.hpp @@ -39,6 +39,7 @@ #include #include +#include namespace mallocMC{ @@ -98,6 +99,8 @@ namespace mallocMC{ typedef T_ReservePoolPolicy ReservePoolPolicy; typedef T_AlignmentPolicy AlignmentPolicy; + typedef std::vector HeapInfoVector; + private: typedef boost::uint32_t uint32; void* pool; @@ -179,8 +182,8 @@ namespace mallocMC{ } MAMC_HOST - std::vector getHeapLocations(){ - std::vector v; + HeapInfoVector getHeapLocations(){ + HeapInfoVector v; v.push_back(heapInfos); return v; } diff --git a/src/include/mallocMC/mallocMC_overwrites.hpp b/src/include/mallocMC/mallocMC_overwrites.hpp index fb0edc41..22f6b631 100644 --- a/src/include/mallocMC/mallocMC_overwrites.hpp +++ b/src/include/mallocMC/mallocMC_overwrites.hpp @@ -33,6 +33,7 @@ #pragma once #include "mallocMC_prefixes.hpp" +#include /** Creates a global object of a many core memory allocator * From 5f4adf5e86614c5d543df6dd895025042b56ba48 Mon Sep 17 00:00:00 2001 From: Benjamin Worpitz Date: Wed, 10 Jun 2015 09:57:15 +0200 Subject: [PATCH 04/17] fix non-matching class/struct declaration --- src/include/mallocMC/oOMPolicies/BadAllocException.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/mallocMC/oOMPolicies/BadAllocException.hpp b/src/include/mallocMC/oOMPolicies/BadAllocException.hpp index a99be38a..9f25ecae 100644 --- a/src/include/mallocMC/oOMPolicies/BadAllocException.hpp +++ b/src/include/mallocMC/oOMPolicies/BadAllocException.hpp @@ -39,7 +39,7 @@ namespace OOMPolicies{ * accelerators. Using this policy on other types of accelerators that do not * support exceptions results in undefined behaviour. */ - class BadAllocException; - + struct BadAllocException; + } //namespace OOMPolicies } //namespace mallocMC From 229c8916afb82594a060e1711d13034d52840536 Mon Sep 17 00:00:00 2001 From: Benjamin Worpitz Date: Fri, 26 Jun 2015 09:09:30 +0200 Subject: [PATCH 05/17] fix unconditional usage of getAvailableSlotsHost Currently the `getAvailableSlotsHost` function of a `CreationPolicy` is required irrespective of its availability. In the [source](https://github.com/ComputationalRadiationPhysics/mallocMC/blob/84c8c20309633c98f69be83153eb897ce2d83110/src/include/mallocMC/mallocMC_hostclass.hpp#L144-155) the `CreationPolicy::providesAvailableSlots::value` flag is checked in a runtime `if` so the function is required for all CreationPolicies even for `OldMalloc`. This has been changed to a compile time construct. --- src/include/mallocMC/mallocMC_hostclass.hpp | 63 ++++++++++++++------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/src/include/mallocMC/mallocMC_hostclass.hpp b/src/include/mallocMC/mallocMC_hostclass.hpp index 1c768305..f4d3b9f9 100644 --- a/src/include/mallocMC/mallocMC_hostclass.hpp +++ b/src/include/mallocMC/mallocMC_hostclass.hpp @@ -64,6 +64,42 @@ namespace mallocMC{ size_t size; }; + namespace detail{ + + /** + * @brief Template class to call getAvailableSlots[Host|Accelerator] if the CreationPolicy provides it. + * + * Returns 0 else. + * + * @tparam T_CreationPolicy The desired type of a CreationPolicy + * @tparam T_ProvidesAvailableSlotsHost If the CreationPolicy provides getAvailableSlotsHost + */ + template + struct GetAvailableSlotsIfAvail + { + template + MAMC_HOST MAMC_ACCELERATOR + static unsigned getAvailableSlots(size_t slotSize, T_Allocator &){ + return 0; + } + }; + template<> + struct GetAvailableSlotsIfAvail< + boost::mpl::bool_ > + { + template + MAMC_HOST MAMC_ACCELERATOR + static unsigned getAvailableSlots(size_t slotSize, T_Allocator & alloc){ +#ifdef __CUDA_ARCH__ + return alloc.getAvailableSlotsAccelerator(slotSize); +#else + return alloc.getAvailableSlotsHost(slotSize, alloc); +#endif + } + }; + + } + /** * @brief "HostClass" that combines all policies to a useful allocator * @@ -144,15 +180,15 @@ namespace mallocMC{ /* * This is a workaround for a bug with getAvailSlotsPoly: * Due to some problems with conditional compilation (possibly a CUDA bug), - * this host function must explicitly be used from inside a host + * getAvailableSlotsHost must explicitly be used from inside a host * function at least once. Doing it here guarantees that it is executed * and that this execution happens on the host. Usually, simply defining * this inside a host function (without actually executing it) would be * sufficient. However, due to the template nature of policy based * design, functions are only compiled if they are actually used. */ - if(CreationPolicy::providesAvailableSlots::value) - CreationPolicy::getAvailableSlotsHost(1024,*this); //actual slot size does not matter + detail::GetAvailableSlotsIfAvail > + ::getAvailableSlots(1024, *this); //actual slot size does not matter return h; } @@ -178,7 +214,10 @@ namespace mallocMC{ // polymorphism over the availability of getAvailableSlots MAMC_HOST MAMC_ACCELERATOR unsigned getAvailableSlots(size_t slotSize){ - return getAvailSlotsPoly(slotSize, boost::mpl::bool_()); + slotSize = AlignmentPolicy::applyPadding(slotSize); + + return detail::GetAvailableSlotsIfAvail > + ::getAvailableSlots(slotSize, *this); } MAMC_HOST @@ -188,22 +227,6 @@ namespace mallocMC{ return v; } - private: - MAMC_HOST MAMC_ACCELERATOR - unsigned getAvailSlotsPoly(size_t slotSize, boost::mpl::bool_){ - return 0; - } - - MAMC_HOST MAMC_ACCELERATOR - unsigned getAvailSlotsPoly(size_t slotSize, boost::mpl::bool_){ - slotSize = AlignmentPolicy::applyPadding(slotSize); -#ifdef __CUDA_ARCH__ - return CreationPolicy::getAvailableSlotsAccelerator(slotSize); -#else - return CreationPolicy::getAvailableSlotsHost(slotSize,*this); -#endif - } - }; } //namespace mallocMC From 01b2dd782e9de7ab305a1f7ce960b98947405cee Mon Sep 17 00:00:00 2001 From: Benjamin Worpitz Date: Mon, 6 Jul 2015 15:41:31 +0200 Subject: [PATCH 06/17] fix a spelling mistake differenciate -> differentiate --- src/include/mallocMC/version.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/mallocMC/version.hpp b/src/include/mallocMC/version.hpp index cbbfe7b5..f301e072 100644 --- a/src/include/mallocMC/version.hpp +++ b/src/include/mallocMC/version.hpp @@ -41,7 +41,7 @@ #define MALLOCMC_VERSION_MINOR 1 #define MALLOCMC_VERSION_PATCH 0 -/** the mallocMC flavor is used to differenciate the releases of the +/** the mallocMC flavor is used to differentiate the releases of the * Computational Radiation Physics group (crp) from other releases * This should be useful to avoid versioning conflicts */ #define MALLOCMC_FLAVOR "crp" From f09c78298e643fa6e90a0b6d6c444429f61c9e46 Mon Sep 17 00:00:00 2001 From: Benjamin Worpitz Date: Mon, 6 Jul 2015 16:40:57 +0200 Subject: [PATCH 07/17] Define __THROW for systems without Glibc __THROW is defined in Glibc so it is not available on all platforms. The safest way to fix this is to define it empty for platforms where it is not available. Maybe it is also safe to remove it completely. --- src/include/mallocMC/mallocMC_overwrites.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/include/mallocMC/mallocMC_overwrites.hpp b/src/include/mallocMC/mallocMC_overwrites.hpp index 22f6b631..87f30312 100644 --- a/src/include/mallocMC/mallocMC_overwrites.hpp +++ b/src/include/mallocMC/mallocMC_overwrites.hpp @@ -83,6 +83,12 @@ bool providesAvailableSlots(){ \ } /* end namespace mallocMC */ +/** __THROW is defined in Glibc so it is not available on all platforms. + */ +#ifndef __THROW + #define __THROW +#endif + /** Create the functions malloc() and free() inside a namespace * * This allows for a peaceful coexistence between different functions called From 3eb9205d4c52f90ecc944207476e89e66b7eb4bc Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 29 Jul 2015 17:41:03 +0200 Subject: [PATCH 08/17] Close #92: Update CMake Version to 2.8.12.2+ Require CMake 2.8.12.2+ for the whole project to ensure the full build chain until a project that is using the FindmallocMC.cmake module will pass. Dependency increase in https://github.com/ComputationalRadiationPhysics/cmake-modules/pull/8 --- CMakeLists.txt | 2 +- INSTALL.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7845597..56c5452c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ project(mallocMC) -cmake_minimum_required(VERSION 2.8.5) +cmake_minimum_required(VERSION 2.8.12.2) # helper for libs and packages set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/" diff --git a/INSTALL.md b/INSTALL.md index c1f3c411..3aabdc83 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -15,7 +15,7 @@ Install - *Debian/Ubuntu:* `sudo apt-get install libboost-dev libboost-program-options-dev` - *Arch Linux:* `sudo pacman -S boost` - or download from [http://www.boost.org/](http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download) - - `CMake` >= 2.8.5 + - `CMake` >= 2.8.12.2 - *Debian/Ubuntu:* `sudo apt-get install cmake file cmake-curses-gui` - *Arch Linux:* `sudo pacman -S cmake` - `git` >= 1.7.9.5 @@ -65,8 +65,8 @@ cmake -DCMAKE_MODULE_PATH=. --help-module FindmallocMC | less and use the following lines in your `CMakeLists.txt`: ```cmake -# this example will require at least CMake 2.8.5 -cmake_minimum_required(VERSION 2.8.5) +# this example will require at least CMake 2.8.12.2 +cmake_minimum_required(VERSION 2.8.12.2) # add path to FindmallocMC.cmake, e.g., in the directory in cmake/ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/) From b4d065797b3b82474908d80cd249d652a12ef48b Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 29 Jul 2015 18:11:41 +0200 Subject: [PATCH 09/17] Add a CMake 2.8.12.2 PPA for Precise --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 802a08c5..3715e7a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,9 @@ script: - make examples before_script: + - sudo add-apt-repository --yes ppa:smspillaz/cmake-2.8.12 - sudo apt-get update -qq + - sudo apt-get install -q -y cmake-data cmake - sudo apt-get install -qq build-essential - sudo apt-get install -qq gcc-4.4 g++-4.4 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 From 0e7e517d24f5b6464b04d3770ae5e95baed0ba2e Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 27 Aug 2015 10:54:56 +0200 Subject: [PATCH 10/17] Add Wshadow GCC: - Wshadow - Werror (used in compile suite) ICC: - Wshadow --- .travis.yml | 2 +- CMakeLists.txt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 802a08c5..a25dfc94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ env: script: - mkdir build_tmp && cd build_tmp - - cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $TRAVIS_BUILD_DIR + - CXXFLAGS="-Werror" cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $TRAVIS_BUILD_DIR - make - make install - make examples diff --git a/CMakeLists.txt b/CMakeLists.txt index b7845597..e536c30d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,18 +46,20 @@ endif(Boost_VERSION EQUAL 105500) # GNU if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") # new warning in gcc 4.8 (flag ignored in previous version) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs") - # ICC +# ICC elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_VARIADIC_TEMPLATES") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_CXX11_VARIADIC_TEMPLATES") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_FENV_H") - # PGI +# PGI elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Minform=inform") endif() From ca39cbc67cf8602ca901ea9d21d84563d5fbbc12 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 27 Aug 2015 11:22:50 +0200 Subject: [PATCH 11/17] Fix Wshadow Warnings --- src/include/mallocMC/mallocMC_utils.hpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/include/mallocMC/mallocMC_utils.hpp b/src/include/mallocMC/mallocMC_utils.hpp index 0353952c..73432592 100644 --- a/src/include/mallocMC/mallocMC_utils.hpp +++ b/src/include/mallocMC/mallocMC_utils.hpp @@ -49,20 +49,20 @@ namespace CUDA class error : public std::runtime_error { private: - static std::string genErrorString(cudaError error, const char* file, int line) + static std::string genErrorString(cudaError errorValue, const char* file, int line) { std::ostringstream msg; - msg << file << '(' << line << "): error: " << cudaGetErrorString(error); + msg << file << '(' << line << "): error: " << cudaGetErrorString(errorValue); return msg.str(); } public: - error(cudaError error, const char* file, int line) - : runtime_error(genErrorString(error, file, line)) + error(cudaError errorValue, const char* file, int line) + : runtime_error(genErrorString(errorValue, file, line)) { } - error(cudaError error) - : runtime_error(cudaGetErrorString(error)) + error(cudaError errorValue) + : runtime_error(cudaGetErrorString(errorValue)) { } @@ -72,11 +72,11 @@ namespace CUDA } }; - inline void checkError(cudaError error, const char* file, int line) + inline void checkError(cudaError errorValue, const char* file, int line) { #ifdef _DEBUG - if (error != cudaSuccess) - throw CUDA::error(error, file, line); + if (errorValue != cudaSuccess) + throw CUDA::error(errorValue, file, line); #endif } @@ -88,9 +88,9 @@ namespace CUDA inline void checkError() { #ifdef _DEBUG - cudaError error = cudaGetLastError(); - if (error != cudaSuccess) - throw CUDA::error(error); + cudaError errorValue = cudaGetLastError(); + if (errorValue != cudaSuccess) + throw CUDA::error(errorValue); #endif } From 1d0b1361ec5cf4d9fac2f822c5c3c206bdf34c11 Mon Sep 17 00:00:00 2001 From: Carlchristian Eckert Date: Fri, 28 Aug 2015 10:37:27 +0200 Subject: [PATCH 12/17] Added TODO to boost_static_assert cast warning - Since the warning (and the cast necessary to suppress it) are solved in newer versions of nvcc/gcc, one bright day in the future might permit us to remove that dreadful cast again. --- src/include/mallocMC/alignmentPolicies/Shrink_impl.hpp | 2 ++ src/include/mallocMC/distributionPolicies/XMallocSIMD_impl.hpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/include/mallocMC/alignmentPolicies/Shrink_impl.hpp b/src/include/mallocMC/alignmentPolicies/Shrink_impl.hpp index f858b60e..cfb1b0c8 100644 --- a/src/include/mallocMC/alignmentPolicies/Shrink_impl.hpp +++ b/src/include/mallocMC/alignmentPolicies/Shrink_impl.hpp @@ -74,6 +74,8 @@ namespace Shrink2NS{ #endif static const uint32 dataAlignment = MALLOCMC_AP_SHRINK_DATAALIGNMENT; + // \TODO: The static_cast can be removed once the minimal dependencies of + // this project is are at least CUDA 7.0 and gcc 4.8.2 BOOST_STATIC_ASSERT(static_cast(dataAlignment) > 0); //dataAlignment must also be a power of 2! BOOST_STATIC_ASSERT(dataAlignment && !(dataAlignment & (dataAlignment-1)) ); diff --git a/src/include/mallocMC/distributionPolicies/XMallocSIMD_impl.hpp b/src/include/mallocMC/distributionPolicies/XMallocSIMD_impl.hpp index f80db7aa..14c35dd6 100644 --- a/src/include/mallocMC/distributionPolicies/XMallocSIMD_impl.hpp +++ b/src/include/mallocMC/distributionPolicies/XMallocSIMD_impl.hpp @@ -77,6 +77,9 @@ namespace DistributionPolicies{ //all the properties must be unsigned integers > 0 BOOST_STATIC_ASSERT(!std::numeric_limits::is_signed); + + // \TODO: The static_cast can be removed once the minimal dependencies of + // this project is are at least CUDA 7.0 and gcc 4.8.2 BOOST_STATIC_ASSERT(static_cast(pagesize) > 0); public: From 17389a55821315b0eeba56863071ae3a9fee7adb Mon Sep 17 00:00:00 2001 From: Carlchristian Eckert Date: Fri, 18 Sep 2015 13:50:28 +0200 Subject: [PATCH 13/17] removed typedef uint32_richtig_huebsch - replaced by `uint32_t` from `` --- src/include/mallocMC/mallocMC_utils.hpp | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/include/mallocMC/mallocMC_utils.hpp b/src/include/mallocMC/mallocMC_utils.hpp index 73432592..3ffc9959 100644 --- a/src/include/mallocMC/mallocMC_utils.hpp +++ b/src/include/mallocMC/mallocMC_utils.hpp @@ -40,6 +40,7 @@ #include #include #include +#include #include "mallocMC_prefixes.hpp" @@ -100,7 +101,7 @@ namespace CUDA #define warp_serial \ - for (uint32_richtig_huebsch __mask = __ballot(1), \ + for (uint32_t __mask = __ballot(1), \ __num = __popc(__mask), \ __lanemask = mallocMC::lanemask_lt(), \ __local_id = __popc(__lanemask & __mask), \ @@ -112,7 +113,6 @@ namespace CUDA namespace mallocMC { - typedef unsigned int uint32_richtig_huebsch; template class __PointerEquivalent @@ -130,70 +130,70 @@ namespace mallocMC typedef mallocMC::__PointerEquivalent::type PointerEquivalent; - MAMC_ACCELERATOR inline uint32_richtig_huebsch laneid() + MAMC_ACCELERATOR inline uint32_t laneid() { - uint32_richtig_huebsch mylaneid; + uint32_t mylaneid; asm("mov.u32 %0, %laneid;" : "=r" (mylaneid)); return mylaneid; } - MAMC_ACCELERATOR inline uint32_richtig_huebsch warpid() + MAMC_ACCELERATOR inline uint32_t warpid() { - uint32_richtig_huebsch mywarpid; + uint32_t mywarpid; asm("mov.u32 %0, %warpid;" : "=r" (mywarpid)); return mywarpid; } - MAMC_ACCELERATOR inline uint32_richtig_huebsch nwarpid() + MAMC_ACCELERATOR inline uint32_t nwarpid() { - uint32_richtig_huebsch mynwarpid; + uint32_t mynwarpid; asm("mov.u32 %0, %nwarpid;" : "=r" (mynwarpid)); return mynwarpid; } - MAMC_ACCELERATOR inline uint32_richtig_huebsch smid() + MAMC_ACCELERATOR inline uint32_t smid() { - uint32_richtig_huebsch mysmid; + uint32_t mysmid; asm("mov.u32 %0, %smid;" : "=r" (mysmid)); return mysmid; } - MAMC_ACCELERATOR inline uint32_richtig_huebsch nsmid() + MAMC_ACCELERATOR inline uint32_t nsmid() { - uint32_richtig_huebsch mynsmid; + uint32_t mynsmid; asm("mov.u32 %0, %nsmid;" : "=r" (mynsmid)); return mynsmid; } - MAMC_ACCELERATOR inline uint32_richtig_huebsch lanemask() + MAMC_ACCELERATOR inline uint32_t lanemask() { - uint32_richtig_huebsch lanemask; + uint32_t lanemask; asm("mov.u32 %0, %lanemask_eq;" : "=r" (lanemask)); return lanemask; } - MAMC_ACCELERATOR inline uint32_richtig_huebsch lanemask_le() + MAMC_ACCELERATOR inline uint32_t lanemask_le() { - uint32_richtig_huebsch lanemask; + uint32_t lanemask; asm("mov.u32 %0, %lanemask_le;" : "=r" (lanemask)); return lanemask; } - MAMC_ACCELERATOR inline uint32_richtig_huebsch lanemask_lt() + MAMC_ACCELERATOR inline uint32_t lanemask_lt() { - uint32_richtig_huebsch lanemask; + uint32_t lanemask; asm("mov.u32 %0, %lanemask_lt;" : "=r" (lanemask)); return lanemask; } - MAMC_ACCELERATOR inline uint32_richtig_huebsch lanemask_ge() + MAMC_ACCELERATOR inline uint32_t lanemask_ge() { - uint32_richtig_huebsch lanemask; + uint32_t lanemask; asm("mov.u32 %0, %lanemask_ge;" : "=r" (lanemask)); return lanemask; } - MAMC_ACCELERATOR inline uint32_richtig_huebsch lanemask_gt() + MAMC_ACCELERATOR inline uint32_t lanemask_gt() { - uint32_richtig_huebsch lanemask; + uint32_t lanemask; asm("mov.u32 %0, %lanemask_gt;" : "=r" (lanemask)); return lanemask; } From af6b7caa935d57e9e7490e98d68a8be75c339581 Mon Sep 17 00:00:00 2001 From: Carlchristian Eckert Date: Fri, 18 Sep 2015 14:39:44 +0200 Subject: [PATCH 14/17] changed type to match __ballot signature --- src/include/mallocMC/mallocMC_utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/mallocMC/mallocMC_utils.hpp b/src/include/mallocMC/mallocMC_utils.hpp index 3ffc9959..fbfff5c6 100644 --- a/src/include/mallocMC/mallocMC_utils.hpp +++ b/src/include/mallocMC/mallocMC_utils.hpp @@ -101,7 +101,7 @@ namespace CUDA #define warp_serial \ - for (uint32_t __mask = __ballot(1), \ + for (unsigned int __mask = __ballot(1), \ __num = __popc(__mask), \ __lanemask = mallocMC::lanemask_lt(), \ __local_id = __popc(__lanemask & __mask), \ From aeab138ace78ae5590baa9948fef07ca889de0bd Mon Sep 17 00:00:00 2001 From: Carlchristian Eckert Date: Mon, 21 Sep 2015 21:21:11 +0200 Subject: [PATCH 15/17] the backslash is now aligned --- src/include/mallocMC/mallocMC_utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/mallocMC/mallocMC_utils.hpp b/src/include/mallocMC/mallocMC_utils.hpp index fbfff5c6..de8b9f0c 100644 --- a/src/include/mallocMC/mallocMC_utils.hpp +++ b/src/include/mallocMC/mallocMC_utils.hpp @@ -101,7 +101,7 @@ namespace CUDA #define warp_serial \ - for (unsigned int __mask = __ballot(1), \ + for (unsigned int __mask = __ballot(1), \ __num = __popc(__mask), \ __lanemask = mallocMC::lanemask_lt(), \ __local_id = __popc(__lanemask & __mask), \ From f57b59b568acb908cffa2797f2df93685660945d Mon Sep 17 00:00:00 2001 From: Carlchristian Eckert Date: Thu, 24 Sep 2015 15:05:01 +0200 Subject: [PATCH 16/17] version bump to 2.2.0crp --- src/include/mallocMC/version.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/mallocMC/version.hpp b/src/include/mallocMC/version.hpp index f301e072..2bfb924e 100644 --- a/src/include/mallocMC/version.hpp +++ b/src/include/mallocMC/version.hpp @@ -38,7 +38,7 @@ /** the mallocMC version: major API changes should be reflected here */ #define MALLOCMC_VERSION_MAJOR 2 -#define MALLOCMC_VERSION_MINOR 1 +#define MALLOCMC_VERSION_MINOR 2 #define MALLOCMC_VERSION_PATCH 0 /** the mallocMC flavor is used to differentiate the releases of the From 248539c6a6c45c004d9e3653f91f1df95888fede Mon Sep 17 00:00:00 2001 From: Carlchristian Eckert Date: Thu, 24 Sep 2015 15:05:17 +0200 Subject: [PATCH 17/17] changelog entry for 2.2.0crp --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c459b16..5f99a2cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,29 @@ Change Log / Release Log for mallocMC ================================================================ +2.2.0crp +------------- +**Date:** 2015-09-25 + +This release fixes some minor bugs that occured after the release of 2.1.0crp, adds some documentation and improves the interoperability with other projects and build systems. +We closed all issues documented in +[Milestone *2.2.0crp: Stabilizing the release*](https://github.com/ComputationalRadiationPhysics/mallocMC/issues?milestone=5&state=closed) + +### Changes to mallocMC 2.1.0crp + +**Features** + - the interface now provides the host function `HeapInfoVector getHeapLocations()` to obtain information about the location and size of existing mallocMC-heaps #86 + +**Bug fixes** + - the function `getAvailableSlots` was always required in the policy classes, although the implementations might not provide it #89 + +**Misc:** + - the code relied on `__TROW` being defined, which is not available in all compilers #91 + - the CMake dependency increased to CMake >= 2.8.12.2 #92 + - a new FindmallocMC.cmake module file is provided at https://github.com/ComputationalRadiationPhysics/cmake-modules #85 + - See the full changes at https://github.com/ComputationalRadiationPhysics/mallocMC/compare/2.1.0crp...2.2.0crp + + 2.1.0crp ------------- **Date:** 2015-02-11