From 95ed584d33c976f3e13568ec8fd9c391de95db07 Mon Sep 17 00:00:00 2001 From: Pietro Incardona <i-bird@linux.fritz.box> Date: Tue, 9 Aug 2016 10:23:02 +0200 Subject: [PATCH] Fixing BHeapMemory copy --- configure.ac | 23 +++++++++++------------ src/Makefile.am | 4 ++-- src/memory/BHeapMemory.hpp | 24 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 00e2994..e64d09d 100755 --- a/configure.ac +++ b/configure.ac @@ -202,12 +202,8 @@ AC_SUBST(BOOST_CPPFLAGS) ####### Checking for GPU support -AX_CUDA - -if test x"$NVCC_EXIST" = x"yes"; then - AC_MSG_CHECKING(whether to build with GPU support) - gpu_support=yes - AC_ARG_ENABLE(gpu, +gpu_support=yes +AC_ARG_ENABLE(gpu, AC_HELP_STRING( [--enable-gpu], [enable gpu support] @@ -215,15 +211,18 @@ if test x"$NVCC_EXIST" = x"yes"; then gpu_support="$enableval" ) - AC_MSG_RESULT($gpu_support) - if test x"$gpu_support" = x"yes"; then - AC_DEFINE([CUDA_GPU],[],[CUDA GPU support]) +AC_MSG_RESULT($gpu_support) + +if test x"$gpu_support" = x"yes"; then + AX_CUDA + + if test x"$NVCC_EXIST" = x"yes"; then + AC_DEFINE([CUDA_GPU],[],[CUDA GPU support]) + else + gpu_support=no fi -else - gpu_support=no fi - # Set this conditional if cuda is wanted # diff --git a/src/Makefile.am b/src/Makefile.am index 0fd3dd7..985eaaa 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,12 +1,12 @@ -LINKLIBS = $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB) $(CUDA_LIBS) $(BOOST_THREAD_LIB) - if BUILDCUDA CUDA_SOURCES=memory/CudaMemory.cu else CUDA_SOURCES= endif +LINKLIBS = $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB) $(CUDA_LIBS) $(BOOST_THREAD_LIB) + noinst_PROGRAMS = mem mem_SOURCES = main.cpp memory/HeapMemory.cpp $(CUDA_SOURCES) Memleak_check.cpp mem_CXXFLAGS = $(INCLUDES_PATH) $(BOOST_CPPFLAGS) -I/usr/local/include diff --git a/src/memory/BHeapMemory.hpp b/src/memory/BHeapMemory.hpp index 6a02117..3f2f074 100644 --- a/src/memory/BHeapMemory.hpp +++ b/src/memory/BHeapMemory.hpp @@ -134,6 +134,30 @@ public: return HeapMemory::size(); } + /*! \brief Copy the memory + * + * + */ + BHeapMemory & operator=(const BHeapMemory & mem) + { + buf_sz = mem.buf_sz; + static_cast<HeapMemory *>(this)->operator=(mem); + + return *this; + } + + /*! \brief Copy the memory + * + * + */ + BHeapMemory & operator=(BHeapMemory && mem) + { + buf_sz = mem.buf_sz; + static_cast<HeapMemory *>(this)->operator=(mem); + + return *this; + } + /*! \brief Destroy the internal memory * * -- GitLab