ebetica / autogradpp

Direct C++ Interface to PyTorch
MIT License
80 stars 12 forks source link

Add define WITH_CUDA to use AutoGPU #60

Closed Kaixhin closed 6 years ago

goldsborough commented 6 years ago

I guess you're not planning on having autogradpp work on non-CUDA platforms? If you later on include a file from PyTorch that has CUDA code enabled by this macro, your library will not compile on CPU (which it does right now)

ebetica commented 6 years ago

The right way to do this is:

#include <ATen/Config.h>

#if AT_CUDA_ENABLED()
#define WITH_CUDA
#endif