-
Notifications
You must be signed in to change notification settings - Fork 47
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
Opencl platform and device selection #67
base: master
Are you sure you want to change the base?
Conversation
d79fbb6
to
dc5abce
Compare
src/Makefile
Outdated
@@ -21,22 +21,35 @@ CL_LIB=cl-crypt | |||
|
|||
CHACHA_IF_DIR:=crypt-if | |||
|
|||
CL_HEADER_DIR:=opencl-platform | |||
# for Windows NVIDIA cygwin sample |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented lines or do some kind of platform detection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to give some examples, but maybe these would be better placed in the Readme ?
src/Makefile
Outdated
|
||
# some instances require optimisations disabled (e.g. AMD on Linux) | ||
# remove "-cl-opt-disable" for default Optimisations to take place | ||
CL_DEVICE_CFLAGS=-cl-opt-disable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok; probably should be runtime detected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the sense of available as environment variable ?
The problem is not so much about detection, but about policy - what to apply on specific platform.
Maybe also get platform and number to environment variables ?
src/Makefile
Outdated
|
||
$V/cl_ecc_main.o: $(CL_ECC_DIR)/main.cpp $(ECC_DIR)/ed25519.h | ||
@mkdir -p $(@D) | ||
$(CXX) $(CL_CFLAGS) -pthread -I$(ECC_DIR) -c $< -o $@ | ||
|
||
$V/$(CL_ECC_TEST_BIN): $V/cl_ecc_main.o $V/lib$(CL_LIB).so | ||
$V/$(CL_ECC_TEST_BIN): $V/cl_ecc_main.o $V/lib$(CL_LIB).a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change to static linking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be reverted.
dc5abce
to
9b33e61
Compare
This set of changes introduces a way to select the platform and device for OpenCL and is used for the binary cl_ed25519_verify
Usage example:
src/debug/cl_ed25519_verify.exe -h
usage: src/debug/cl_ed25519_verify [-v] <num_signatures> <num_elems> <num_sigs_per_packet> <num_threads> <num_iterations> <use_non_default_stream> <cl_platform_id> <cl_device_id>
$ ./cl_ed25519_verify 100000 1 1 1 1 1 1 2
OpenCL platform query & init...
OpenCL init devices query type: ALL
Platforms found: 2
Platform 0 Intel(R) Corporation OpenCL 1.2 LINUX
Devices found 1
Device 0 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
Platform 1 NVIDIA Corporation OpenCL 1.2 CUDA 9.1.84
Devices found 3
Device 0 Tesla K40m
Device 1 Tesla K40m
Device 2 Tesla K40m <----- SELECTED
Compiling sha256 kernels
Compiling verify kernels
time diff: 157882.000000 total: 100000 signs/sec: 633384.426344
time diff: 1380897.000000 total: 100000 verifies/sec: 72416.697263
$ ./cl_ed25519_verify.exe 10000 1 1 1 1 1 1 0
OpenCL platform query & init...
OpenCL init devices query type: ALL
Platforms found: 2
Platform 0 Intel(R) Corporation OpenCL 1.2
Devices found 1
Device 0 Intel(R) Core(TM) i3-3250 CPU @ 3.50GHz
Platform 1 Advanced Micro Devices, Inc. OpenCL 2.1 AMD-APP (3004.7)
Devices found 4
Device 0 Hawaii <----- SELECTED
Device 1 Hawaii
Device 2 Hawaii
Device 3 Fiji
Compiling sha256 kernels
Compiling verify kernels
time diff: 55538.000000 total: 10000 signs/sec: 180056.897980
time diff: 23255.000000 total: 10000 verifies/sec: 430015.050527
$ ./cl_ed25519_verify 1 1 1 1 1 1 0 0
OpenCL platform query & init...
OpenCL init devices query type: ALL
Platforms found: 2
Platform 0 Intel(R) Corporation OpenCL 1.2 LINUX
Devices found 1
Device 0 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz <----- SELECTED
Platform 1 NVIDIA Corporation OpenCL 1.2 CUDA 9.1.84
Devices found 3
Device 0 Tesla K40m
Device 1 Tesla K40m
Device 2 Tesla K40m
Compiling sha256 kernels
Compiling verify kernels
8 warnings generated.
time diff: 4297.000000 total: 1 signs/sec: 232.720503
time diff: 1835.000000 total: 1 verifies/sec: 544.959128