Commit 61ec4f1a authored by Jeff Daily's avatar Jeff Daily
Browse files

[ROCm] re-add support for ROCm builds

Previously #6086 added ROCm support but after numerous rebases it lost
critical changes. This PR restores the ROCm build.

There are many source file changes but most were automated using the
following:

```bash
for f in `grep -rl '#ifdef USE_CUDA'`
do
    sed -i 's@#ifdef USE_CUDA@#if defined(USE_CUDA) || defined(USE_ROCM)@g' $f
done

for f in `grep -rl '#endif  // USE_CUDA'`
do
    sed -i 's@#endif  // USE_CUDA@#endif  // USE_CUDA || USE_ROCM@g' $f
done
```
parent 336a77df
......@@ -9,7 +9,7 @@
#include <memory>
#include <vector>
#ifdef USE_CUDA
#if defined(USE_CUDA) || defined(USE_ROCM)
#include "cuda_leaf_splits.hpp"
#include "cuda_histogram_constructor.hpp"
......@@ -144,7 +144,7 @@ class CUDASingleGPUTreeLearner: public SerialTreeLearner {
} // namespace LightGBM
#else // USE_CUDA
#else // USE_CUDA || USE_ROCM
// When GPU support is not compiled in, quit with an error message
......@@ -155,11 +155,11 @@ class CUDASingleGPUTreeLearner: public SerialTreeLearner {
#pragma warning(disable : 4702)
explicit CUDASingleGPUTreeLearner(const Config* tree_config, const bool /*boosting_on_cuda*/) : SerialTreeLearner(tree_config) {
Log::Fatal("CUDA Tree Learner was not enabled in this build.\n"
"Please recompile with CMake option -DUSE_CUDA=1");
"Please recompile with CMake option -DUSE_CUDA=1 or -DUSE_ROCM=1");
}
};
} // namespace LightGBM
#endif // USE_CUDA
#endif // USE_CUDA || USE_ROCM
#endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_SINGLE_GPU_TREE_LEARNER_HPP_
......@@ -216,7 +216,7 @@ class SerialTreeLearner: public TreeLearner {
std::vector<score_t, boost::alignment::aligned_allocator<score_t, 4096>> ordered_gradients_;
/*! \brief hessians of current iteration, ordered for cache optimized, aligned to 4K page */
std::vector<score_t, boost::alignment::aligned_allocator<score_t, 4096>> ordered_hessians_;
#elif defined(USE_CUDA)
#elif defined(USE_CUDA) || defined(USE_ROCM)
/*! \brief gradients of current iteration, ordered for cache optimized */
std::vector<score_t, CHAllocator<score_t>> ordered_gradients_;
/*! \brief hessians of current iteration, ordered for cache optimized */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment