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

Make ngm work on computers with more than 256 cores #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
ENDIF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)

IF(NOT APPLE)
SET (CMAKE_CXX_FLAGS_RELEASE "-L${EXECUTABLE_OUTPUT_PATH}/opencl/lib")
SET (CMAKE_CXX_FLAGS_DEBUG "-L${EXECUTABLE_OUTPUT_PATH}/opencl/lib")
SET (CMAKE_CXX_FLAGS_RELEASE "-L${EXECUTABLE_OUTPUT_PATH}/opencl/lib -std=c++11")
SET (CMAKE_CXX_FLAGS_DEBUG "-L${EXECUTABLE_OUTPUT_PATH}/opencl/lib -std=c++11")
endif()


Expand Down
12 changes: 9 additions & 3 deletions lib/mason/opencl/OclHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <string.h>
#include <pthread.h>
#include "IConfig.h"
#include <thread>

pthread_mutex_t mutext_next_sub_block;

Expand Down Expand Up @@ -108,11 +109,16 @@ OclHost::OclHost(int const device_type, int gpu_id, int const cpu_cores) :
cl_device_partition_property props[3];

props[0] = CL_DEVICE_PARTITION_EQUALLY; // Equally
props[1] = 1; // 4 compute units per sub-device
props[1] = 1; // compute units per sub-device
props[2] = 0;

devices = (cl_device_id *) malloc(256 * sizeof(cl_device_id));
ciErrNum = clCreateSubDevices(device_id, props, 256, devices,
unsigned int threads = std::thread::hardware_concurrency();
if ( threads == 0 ) {
threads = 2560;
Log.Message("Number of concurrent threads not well defined or not computable. Using default of %d.", threads);
}
devices = (cl_device_id *) malloc(threads * sizeof(cl_device_id));
ciErrNum = clCreateSubDevices(device_id, props, threads, devices,
&ciDeviceCount);
if (ciErrNum == -18) {
ciDeviceCount = 1;
Expand Down