Skip to content

Add OpenCL back in and fixup pointer types in kernel0_local_write #51

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

Open
wants to merge 2 commits into
base: dev
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
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ if(NOT MSVC)
endif()

find_package(Threads REQUIRED)
find_package(OpenCL REQUIRED)


################################################################################
Expand All @@ -128,6 +129,11 @@ add_executable(cuda_memtest
cuda_memtest.cpp
)

add_executable(ocl_memtest
ocl_tests.cpp
ocl_memtest.cpp
)

if(CUDA_MEMTEST_BACKEND STREQUAL "cuda")
target_link_libraries(cuda_memtest INTERFACE CUDA::cudart)
target_link_libraries(cuda_memtest INTERFACE CUDA::cuda_driver)
Expand All @@ -152,6 +158,10 @@ endif()

if(NOT MSVC)
target_link_libraries(cuda_memtest PRIVATE Threads::Threads)
target_link_libraries(ocl_memtest
PRIVATE Threads::Threads
PRIVATE OpenCL::OpenCL
)
endif()

## annotate with RPATH's
Expand All @@ -175,11 +185,14 @@ endif()
option(CUDA_MEMTEST_RELEASE "disable all runtime asserts" ON)
if(CUDA_MEMTEST_RELEASE)
target_compile_definitions(cuda_memtest PRIVATE NDEBUG)
target_compile_definitions(ocl_memtest PRIVATE NDEBUG)
endif(CUDA_MEMTEST_RELEASE)

################################################################################
# Install cuda_memtest
################################################################################

install(TARGETS cuda_memtest
install(TARGETS
cuda_memtest
ocl_memtest
RUNTIME DESTINATION bin)
2 changes: 1 addition & 1 deletion ocl_memtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ unsigned int exit_on_error = 0;



#define KERNEL_FILE "ocl_memtest_kernels.cpp"
#define KERNEL_FILE "ocl_memtest_kernels.cl"

#define MAX_KERNEL_FILE_SIZE (1024*1024)

Expand Down
12 changes: 6 additions & 6 deletions ocl_memtest_kernels.cpp → ocl_memtest_kernels.cl
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,9 @@ kernel0_local_write(__global char* ptr, unsigned long memsize)


for(i=idx; i < n; i+= total_num_threads){
__global unsigned long * start_p= (__global unsigned long)(ptr + i*BLOCKSIZE);
__global unsigned long* end_p = (__global unsigned long*)(ptr + (i+1)*BLOCKSIZE);
__global unsigned long * p =start_p;
__global unsigned long * start_p = (__global unsigned long*)(ptr + i*BLOCKSIZE);
__global unsigned long * end_p = (__global unsigned long*)(ptr + (i+1)*BLOCKSIZE);
__global unsigned long * p = start_p;
unsigned int pattern = 1;
unsigned int mask = 8;

Expand Down Expand Up @@ -645,9 +645,9 @@ kernel0_local_read(__global char* ptr, unsigned long memsize,


for(i=idx; i < n; i+= total_num_threads){
__global unsigned long * start_p= (__global unsigned long)(ptr + i*BLOCKSIZE);
__global unsigned long* end_p = (__global unsigned long*)(ptr + (i+1)*BLOCKSIZE);
__global unsigned long * p =start_p;
__global unsigned long * start_p = (__global unsigned long*)(ptr + i*BLOCKSIZE);
__global unsigned long * end_p = (__global unsigned long*)(ptr + (i+1)*BLOCKSIZE);
__global unsigned long * p = start_p;
unsigned int pattern = 1;
unsigned int mask = 8;

Expand Down