-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Install documentation for LightGBM on GPU #389
Comments
@Laurae2 I will work on move the documentation on my development repository to here. |
For python I think just using the GPU-enabled shared library and pass |
I update some documents for GPU, @huanzhang12 can you check them? For R/python package, I think they both need to pass the additional paramter |
@guolinke For the building procedure, we need to mention the dependency package ( |
@guolinke @Laurae2 It seems I can't make a pull request to the wiki (github does not have this feature). So I am not able to directly edit it. But most detailed instructions are on my development repository page. You can probably move most materials to the wiki, perhaps adding a "GPU tutorial", helping people to setup GPU training and achieve good speedup. |
@huanzhang12 you can put your materials to the docs/... , I can add a link to it in the wiki. |
@guolinke OK, I think I will put a tutorial there |
@guolinke for R package we might have to convert the cmake to make in Makevars. I found this but I don't know how it could be integrated: https://github.com/forexample/r-cmake @huanzhang12 R in Windows uses MinGW, while in Unix it uses the default way of installation. Are they enough alone or do we need more to install with GPU support? If cmake is a must, we might try to find to workaround for R. Also, can we use environment variables? (if there are any to use) We may also attempt to detect whether boost is existing or not (by checking whether
|
I don't have machine to test gpu version right now. @huanzhang12 can you also help update python package? |
@Laurae2 It is fine if we don't have cmake. I list cmake 3.x as a dependency just because I need to look for OpenCL and boost headers/libraries automatically in But the problem is to detect the existence of OpenCL and boost, and enable GPU support accordingly. If we can't do this automatically, we will probably have to provide two Makevars, and an user must ensure that necessary dependencies have been installed and manually use the one with GPU support to compile. @Laurae2 I am not sure what environment variables you want to use? Do you want to detect the existence of OpenCL/boost using environment variables? @wxchan Currently it seems the Python package is working, by compiling LightGBM with GPU support as normal and then run For both Python and R, as @guolinke mentioned, the user needs to pass the additional parameter BTW, the GPU code can be tested without real GPUs installed. The beauty of OpenCL (unlike CUDA) is that it is a universal standard, targeting a wide range of device include CPU and GPU. You can install Intel OpenCL runtime or AMD APP SDK to get OpenCL working on CPUs (slow but good enough for testing). Currently in .travis.yml we test the GPU code using this way (and in fact we are already using the python interface there). |
can it work on mac? I got segfault on my machine.
|
@wxchan It should work on mac as it detects your Intel HD 5000 GPU as a OpenCL device. Glad to see you get it compiled successfully! Base on the backtrace it seems the problem is in the offline cache of Boost.Compute. The offline cache is for caching compiled GPU kernels, so that it does not need to be compiled again when next time you launch LightGBM with GPU. From the backtrace I guess it crashed during creating the cache directory Based on
On my Linux machine it creates a folder ".boost_compute" in my home folder, not sure how it works for Mac. If you can figure out the exact reason of the crash, you can submit a PR to Boost.Compute. Otherwise, you can remove the macro |
It works after comment out |
@wxchan Glad to know it works for you! I can add this to instruction, but please report this bug to Boost.Compute so that they can fix it in a future release. Offline cache is a nice feature to have, otherwise the user has to wait for kernel compilation ( I guess it is not a hard problem to fix, probably just add a |
@huanzhang12 @guolinke I managed to compile with with GPU trainer in R + Windows! Will come very soon with a PR for enabling GPU in R package. |
@Laurae2 Which method did you used? Visual studio or mingw? |
@gugatr0n1c I used only MinGW for CLI, Python, and R, no need Visual Studio for compiling LightGBM and Boost (performance might vary though). @huanzhang12 Got the same issue in Windows about @wxchan issue on Mac. Commenting that line 26 |
@Laurae2 Glad to know you get it working on Windows! I think we need to look into the BOOST_COMPUTE_USE_OFFLINE_CACHE issue a little bit, because I think offline cache is a good feature to have; otherwise each time we have to wait for a few seconds to get GPU kernels compiled, which is annoying. @Laurae2 You can probably try to remove the OpenMP pragma at https://github.com/Microsoft/LightGBM/blob/master/src/treelearner/gpu_tree_learner.cpp#L569. I think probably Boost.Compute has a bug when using multiple threads to build the kernel. We need to report it to Boost.Compute if we can track down the issue. |
@Laurae2 I am able to fix the offline cache issue in Boost.Compute on Windows. I have created a pull request at Boost.Compute repository: boostorg/compute#704 |
@huanzhang12 now we have good documentation for Linux and Windows, and on how to choose device/platform. We still lack some doc for Mac, and I don't have access to my Mac currently. Someone volunteering to make some Mac documentation:
|
@Laurae2 Thanks for your hard work on getting the instructions on Windows ready! Based on the previous issues on Mac you mentioned, it could be tricky to get everything working on Mac. Currently I don't have access to any Mac computers, and I can't find any cloud computing service providing Mac virtual machines with GPU. So we need to look for some volunteers here. |
Add MSVC build guide on https://github.com/Microsoft/LightGBM/wiki/Installation-Guide#windows-2 . |
@guolinke great! Now, the last is Mac to do. perhaps you can add a call for contribution for docs on this. |
@Laurae2 Did we solve the gpu build for R ? |
@guolinke GPU build works for R in Windows and in Linux as they work nearly identically in R (just feed 4 extra variables in Linux got freedom to use the default compiler which may be common for CLI / Python, in Windows it is mandatory to use Rtools' MinGW. For Mac + R, it should be the same as Linux except it requires to be able first to compile the CPU-only version (gcc, OpenMP issues...). |
@Laurae2 , can you please give more details on the GPU build for R in Linux? Not sure what's involved on the "feed 4 extra variables in Makeconf + modify Makevars + add gpu_tree_learner in include" steps. Thanks! |
@zhukunism on linux it depends too much on where you things are installed by the OS (or where you install them), I can't really make more detailed. The same rules from Windows applies on Linux, with a different file naming scheme: |
Successfully build LightGBM with GPU support on Ubuntu 16.04 and installed a Python version. Able to run in python with As far as R version is concerned, which is installed by further running I would really appreciate a clear instruction on installing R version on Linux with GPU support. |
@bushmanov |
@Laurae2 , I set the boost and openCL env variables as you suggested. But still get the errors below when building on my ubuntu machine:
The OpenCL headers and so are installed properly: $ ls /usr/include/CL/ $ ls /usr/lib/x86_64-linux-gnu/libOpenCL.so Do you have any ideas? many thanks! |
@zhukunism For R installation, you can now use a precompiled lib you have to put in root of LightGBM folder (if it compiled elsewhere). Compile it as if you were doing for CLI, then compile the R package. It is now much easier to compile R with GPU support that way. Current R installation can't compile with custom flags currently (you can override them by editing the sys/install.libs.R of the package. Remember to adjust |
A following error came when I use R 3.3.3 to install lgb with devtools:
translated as:
ps: cmake 3.9, rtools3.4 and vs2017 have been installed |
@jzun it seems your r version is 32-bit (i386), can you use the 64-bit R ? |
@guolinke it seems i just used the 64-bit to install with its head line in R console:
|
@jzun maybe you are using the 32-bit Rtools ? And did you have a folder |
@guolinke |
@guolinke |
@jzun |
@guolinke |
@jzun sure |
This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
Related to PR #368
Is there any documentation to install, setup, and use LightGBM on GPU? As the docs folder and the Wiki did not change, I was wondering if there are specific steps required.
Similar to this, but for this repository.
Similar question for:
To-do:
The text was updated successfully, but these errors were encountered: