PhoenixHardware  0.2.0
Tools to get hardware information
Loading...
Searching...
No Matches
phoenix_template_alloc.h
Go to the documentation of this file.
1/***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6
7#ifndef __PHOENIX_TEMPLATE_ALLOC_H__
8#define __PHOENIX_TEMPLATE_ALLOC_H__
9
10#include <iostream>
13
14namespace Phoenix{
17 NONE = 0,
20 };
21}
22
23#ifdef PHOENIX_GPU_MODE
24# define PHOENIX_AUTO_ALIGNED Phoenix::NONE
25# define PHOENIX_AUTO_PADDING Phoenix::NONE
26#else
27# define PHOENIX_AUTO_ALIGNED Phoenix::ALIGNED
28# define PHOENIX_AUTO_PADDING Phoenix::PADDING
29#endif
30
31template<typename T>
32size_t phoenix_getPadding(size_t nbElement);
33
34template<typename T>
35T * phoenix_template_alloc(size_t & padding, bool & isAligned, Phoenix::AllocMode mode, const size_t * tabDim, size_t nbDim);
36template<typename T>
37T * phoenix_template_alloc_aligned1d(size_t nbValue);
38template<typename T>
39void phoenix_newAlignedTab(T* & alignedPtr, size_t sizeOfVectorInT);
40
41size_t phoenix_getFullSize(const size_t * tabDim, size_t nbDim);
42void phoenix_copyShape(size_t *& destTabDim, const size_t * tabDim, size_t nbDim);
43void phoenix_copyShape(size_t *& destTabDim, size_t & destNbDim, const size_t * tabDim, size_t nbDim);
44
45bool phoenix_isSameShape(const size_t * tabDim1, size_t nbDim1, const size_t * tabDim2, size_t nbDim2);
46
48
49#endif
AllocMode
Allocation mode of the PTensor.
size_t phoenix_getPadding(size_t nbElement)
Get the padding with respect to the number of elements of the tables.
void phoenix_copyShape(size_t *&destTabDim, const size_t *tabDim, size_t nbDim)
Copy a shape of a tensor into an other.
void phoenix_newAlignedTab(T *&alignedPtr, size_t sizeOfVectorInT)
Alloc an aligned vector.
size_t phoenix_getFullSize(const size_t *tabDim, size_t nbDim)
Get the fulle size of the tensor.
T * phoenix_template_alloc_aligned1d(size_t nbValue)
Do a template allcoation of a type.
bool phoenix_isSameShape(const size_t *tabDim1, size_t nbDim1, const size_t *tabDim2, size_t nbDim2)
Say if two shapes are the same or not.
T * phoenix_template_alloc(size_t &padding, bool &isAligned, Phoenix::AllocMode mode, const size_t *tabDim, size_t nbDim)
Allocate a tensor.