Commit 3c7685ad authored by incardon's avatar incardon

Adding add_ for tensor of rank 2

parent 302a59e9
Pipeline #756 failed with stages
in 4 seconds
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(openfpm_pdata LANGUAGES C CXX)
project(openfpm_pdata LANGUAGES C CXX CUDA)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake_modules/)
......@@ -12,7 +12,6 @@ set(SE_CLASS3 CACHE BOOL "Activate compilation with SE_CLASS3")
set(ENABLE_GPU CACHE BOOL "Disable the GPU code independently that a cuda compiler is found")
if (ENABLE_GPU)
enable_language(CUDA)
find_package(CUDA)
endif()
......
......@@ -13,7 +13,7 @@ add_executable(mem_map ../../openfpm_devices/src/Memleak_check.cpp main.cpp util
###########################
if (CUDA_fOUND)
if (CUDA_FOUND)
target_compile_options(mem_map PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe "--display_error_number --diag_suppress=2885 --diag_suppress=2887 --diag_suppress=2888 --diag_suppress=186 --diag_suppress=111" --expt-extended-lambda>)
endif()
......
......@@ -185,8 +185,6 @@ public:
return false;
}
#ifdef CUDA_GPU
/*! \brief Copy the memory from host to device
*
* \tparam (all properties are copied to prp is useless in this case)
......@@ -247,6 +245,8 @@ public:
this->data_.mem->deviceToHost(start*sizeof(T),(stop+1)*sizeof(T));
}
#ifdef CUDA_GPU
/*! \brief Convert the grid into a data-structure compatible for computing into GPU
*
* The object created can be considered like a reference of the original
......@@ -554,8 +554,6 @@ public:
boost::fusion::at_c<id>(this->data_).mem->fill(c);
}
#ifdef CUDA_GPU
/*! \brief Copy the memory from host to device
*
*/
......@@ -619,6 +617,8 @@ public:
boost::mpl::for_each_ref< boost::mpl::range_c<int,0,sizeof...(prp)> >(dth);
}
#ifdef CUDA_GPU
/*! \brief Convert the grid into a data-structure compatible for computing into GPU
*
* The object created can be considered like a reference of the original
......
......@@ -702,24 +702,6 @@ namespace openfpm
{
add_prp_device_impl<std::is_same<Memory,CudaMemory>::value,T,Memory,layout,layout_base,grow_p>
::template run<S,M,gp,impl,layout_base2,args...>(*this,v);
/*
#ifdef SE_CLASS2
check_valid(this,8);
#endif
// merge the data on device
#if defined(CUDA_GPU) && defined(__NVCC__)
size_t old_sz = size();
this->resize(size() + v.size(),DATA_ON_DEVICE);
auto ite = v.getGPUIterator();
merge_add_prp_device_impl<decltype(v.toKernel()),decltype(this->toKernel()),args...><<<ite.wthr,ite.thr>>>(v.toKernel(),this->toKernel(),(unsigned int)old_sz);
#else
std::cout << __FILE__ << ":" << __LINE__ << " Error the function add_prp_device only work when map_vector is compiled with nvcc" << std::endl;
#endif*/
}
/*! \brief Insert an entry in the vector
......@@ -1630,8 +1612,6 @@ namespace openfpm
return base;
}
#ifdef CUDA_GPU
/*! \brief Copy the memory from host to device
*
*
......@@ -1704,8 +1684,6 @@ namespace openfpm
return v;
}
#endif
void * internal_get_size_pointer() {return &v_size;}
void print_size()
......
......@@ -167,7 +167,7 @@ struct copy_general_op
*/
inline copy_general_op(const T & src, T & dst)
{
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " " << demangle(typeid(T).name()) << " does not have an operator= and is not an aggregate or an openfpm native structure, copy is not possible" << "\n";
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " " << demangle(typeid(T).name()) << " does not have an operator " << demangle(typeid(op<T,T>).name()) << "defined" << std::endl;
}
};
......
......@@ -837,4 +837,26 @@ struct meta_copy_op_d<op,Tsrc[N1],Tdst[N1]>
}
};
//! Partial specialization for N=2 2D-Array
template<template<typename,typename> class op, typename Tsrc, typename Tdst, size_t N1, size_t N2>
struct meta_copy_op_d<op,Tsrc[N1][N2],Tdst[N1][N2]>
{
/*! \brief copy and object from src to dst
*
* \param src source object to copy
* \param dst destination object
*
*/
static inline void meta_copy_op_d_(const Tsrc src[N1][N2], Tdst dst[N1][N2])
{
for (size_t i1 = 0 ; i1 < N1 ; i1++)
{
for (size_t i2 = 0 ; i2 < N2 ; i2)
{
copy_general_op<op,Tdst>(src[i1][i2],dst[i1][i2]);
}
}
}
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment