Skip to content
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

Support Windows in CUDA version #3837

Closed
StrikerRUS opened this issue Jan 24, 2021 · 6 comments
Closed

Support Windows in CUDA version #3837

StrikerRUS opened this issue Jan 24, 2021 · 6 comments

Comments

@StrikerRUS
Copy link
Collaborator

StrikerRUS commented Jan 24, 2021

Right now CUDA version can be built only on Linux. The main blocker of making CUDA working on Windows is

Unfortunately the CUDA changes for LightGBM require pthreads, as of now, and Windows doesn't (easily) support pthreads.
#3160 (comment)

Source code references:

pthread_t **cpu_threads_; // pthread, 1 cpu thread / gpu

for (int device_id = 0; device_id < num_gpu_; ++device_id) {
if (pthread_create(cpu_threads_[device_id], NULL, launch_cuda_histogram, reinterpret_cast<void *>(&thread_data[device_id]))) {
Log::Fatal("Error in creating threads.");
}
}
/* Wait for the threads to finish */
for (int device_id = 0; device_id < num_gpu_; ++device_id) {
if (pthread_join(*(cpu_threads_[device_id]), NULL)) {
Log::Fatal("Error in joining threads.");
}
}

// set cpu threads
cpu_threads_ = reinterpret_cast<pthread_t **>(_mm_malloc(sizeof(pthread_t *)*num_gpu_, 16));
for (int device_id = 0; device_id < num_gpu_; ++device_id) {
cpu_threads_[device_id] = reinterpret_cast<pthread_t *>(_mm_malloc(sizeof(pthread_t), 16));
}

Code blocks listed above should be rewritten in a cross-platform manner.

Or if it is impossible, pthread's port for Windows can be properly added in source files tree to make code above works with Visual Studio. For example,

@StrikerRUS
Copy link
Collaborator Author

Closed in favor of being in #2302. We decided to keep all feature requests in one place.

Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature.

@StrikerRUS
Copy link
Collaborator Author

@shiyu1994
Are there any plans for supporting new CUDA implementation on Windows? #4528

@shiyu1994
Copy link
Collaborator

@StrikerRUS Thanks for proposing this, and thanks for the investigation! Definitely, we have plan for CUDA version on Windows, but not necessarily in 4.0.0. If the changes for windows require only minor revision, we may try to include it in 4.0.0. I think by now we'd better focus on make the new CUDA version stable on Linux. And then we can head for Windows. WDYT?

@StrikerRUS
Copy link
Collaborator Author

@shiyu1994 Yeah, totally fine! I just wanted to hear your opinion on this issue and further plans. Thanks!

@github-actions

This comment was marked as off-topic.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2023
@jameslamb
Copy link
Collaborator

Sorry, this was locked accidentally. Just unlocked it. We'd still love help with this feature!

@microsoft microsoft unlocked this conversation Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants