MorphoGraphX  2.0-1-227
DistObjectCuda.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2016 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef DIST_OBJECT_CUDA_HPP
12 #define DIST_OBJECT_CUDA_HPP
13 
14 #include <Cuda.hpp>
15 #include <ThrustTypes.hpp>
16 
17 // Public Cuda interface methods
18 namespace mgx
19 {
20  template<typename T1, typename T2>
21  int mgx_EXPORT copyGPU(T1 *src, T2 *dst)
22  {
23  if(!src or !dst)
24  return 1;
25  *dst = *src;
26 
27  return 0;
28  }
29 
30  template<typename T>
31  int mgx_EXPORT allocGPU(T **vec, size_t n)
32  {
33  if(n == 0) {
34  if(*vec) {
35  delete *vec;
36  *vec = 0;
37  }
38  return 1;
39  }
40  if(!*vec)
41  *vec = new T;
42  (*vec)->resize(n);
43 
44  return 0;
45  }
46 }
47 #endif
mgx::copyGPU
int mgx_EXPORT copyGPU(T1 *src, T2 *dst)
Definition: DistObjectCuda.hpp:21
n
#define n
Definition: Eigenvalues.hpp:36
ThrustTypes.hpp
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::allocGPU
int mgx_EXPORT allocGPU(T **vec, size_t n)
Definition: DistObjectCuda.hpp:31
Cuda.hpp