Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame^] | 1 | |
| 2 | namespace Eigen { |
| 3 | |
| 4 | /** \page TopicCUDA Using Eigen in CUDA kernels |
| 5 | |
| 6 | \b Disclaimer: this page is about an \b experimental feature in %Eigen. |
| 7 | |
| 8 | Staring from CUDA 5.0, the CUDA compiler, \c nvcc, is able to properly parse %Eigen's code (almost). |
| 9 | A few adaptations of the %Eigen's code already allows to use some parts of %Eigen in your own CUDA kernels. |
| 10 | To this end you need the devel branch of %Eigen, CUDA 5.0 or greater with GCC. |
| 11 | |
| 12 | Known issues: |
| 13 | |
| 14 | - \c nvcc with MS Visual Studio does not work (patch welcome) |
| 15 | |
| 16 | - \c nvcc with \c clang does not work (patch welcome) |
| 17 | |
| 18 | - \c nvcc 5.5 with gcc-4.7 (or greater) has issues with the standard \c \<limits\> header file. To workaround this, you can add the following before including any other files: |
| 19 | \code |
| 20 | // workaround issue between gcc >= 4.7 and cuda 5.5 |
| 21 | #if (defined __GNUC__) && (__GNUC__>4 || __GNUC_MINOR__>=7) |
| 22 | #undef _GLIBCXX_ATOMIC_BUILTINS |
| 23 | #undef _GLIBCXX_USE_INT128 |
| 24 | #endif |
| 25 | \endcode |
| 26 | |
| 27 | - On 64bits system Eigen uses \c long \c int as the default type for indexes and sizes. On CUDA device, it would make sense to default to 32 bits \c int. |
| 28 | However, to keep host and CUDA code compatible, this cannot be done automatically by %Eigen, and the user is thus required to define \c EIGEN_DEFAULT_DENSE_INDEX_TYPE to \c int throughout his code (or only for CUDA code if there is no interaction between host and CUDA code through %Eigen's object). |
| 29 | |
| 30 | */ |
| 31 | |
| 32 | } |