deephealthproject / eddl

European Distributed Deep Learning (EDDL) library. A general-purpose library initially developed to cover deep learning needs in healthcare use cases within the DeepHealth project.
https://deephealthproject.github.io/eddl/
MIT License
34 stars 10 forks source link

Add preprocessor directives for FPGA #325

Open salvacarrion opened 2 years ago

salvacarrion commented 2 years ago

Add preprocessor directives for FPGA

If we have a code (usually in tensor) that depends on a specific compilation to work (i.e hardware), we should encapsulate it with its corresponding preprocessing directive.

The reason behind this is that Tensor::isCPU/isGPU/isFPGA() relies on the Tensor->device value which can be set by the user and lead to errors hard to debug.

Example:

if (A->isCPU()) {  // CPU
  // Do stuff
}

#ifdef cGPU
else if (A->isGPU()){  // GPU
  // Do stuff
}
#endif

#ifdef cFPGA
else if (A->isFPGA()) {  // FPGA
  // do stuff
}
#endif