From: Erik Lindahl Date: Thu, 25 Jun 2015 19:01:26 +0000 (-0400) Subject: Replace functions deprecated in OpenCL 1.2 X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=71aeaca3ef0ffcbf995ac2a49aea33b7169de3a3;p=alexxy%2Fgromacs.git Replace functions deprecated in OpenCL 1.2 Check for CL_VERSION_1_2 in the source, and use newer versions in that case to avoid warnings about deprecated functions. Change-Id: I6f70e0178fa06c59be57168d94aae0fd7df148f5 --- diff --git a/cmake/gmxManageOpenCL.cmake b/cmake/gmxManageOpenCL.cmake index 254ecf1693..721defc8df 100644 --- a/cmake/gmxManageOpenCL.cmake +++ b/cmake/gmxManageOpenCL.cmake @@ -52,11 +52,6 @@ else () return() endif() -# Prevent warnings when linking against OpenCL > 1.1 -if (OPENCL_VERSION_STRING VERSION_GREATER 1.1) - set(OPENCL_DEFINITIONS "-DCL_USE_DEPRECATED_OPENCL_1_1_APIS") -endif() - # Tell compiler to hide warnings for comments caused by cl_gl_ext.h on Linux if (UNIX) set(OPENCL_DEFINITIONS ${OPENCL_DEFINITIONS} " -Wno-comment") @@ -64,9 +59,6 @@ endif() add_definitions(${OPENCL_DEFINITIONS}) - -#define CL_USE_DEPRECATED_OPENCL_1_1_APIS - include_directories(${OPENCL_INCLUDE_DIRS}) macro(gmx_gpu_setup) diff --git a/src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl.cpp b/src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl.cpp index 476372e455..344464350d 100644 --- a/src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl.cpp +++ b/src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl.cpp @@ -325,7 +325,11 @@ void sync_ocl_event(cl_command_queue stream, cl_event *ocl_event) cl_int gmx_unused cl_error; /* Enqueue wait */ +#ifdef CL_VERSION_1_2 + cl_error = clEnqueueBarrierWithWaitList(stream, 1, ocl_event, NULL); +#else cl_error = clEnqueueWaitForEvents(stream, 1, ocl_event); +#endif assert(CL_SUCCESS == cl_error); @@ -453,7 +457,11 @@ void nbnxn_gpu_launch_kernel(gmx_nbnxn_ocl_t *nb, { if (iloc == eintLocal) { +#ifdef CL_VERSION_1_2 + cl_error = clEnqueueMarkerWithWaitList(stream, 0, NULL, &(nb->misc_ops_done)); +#else cl_error = clEnqueueMarker(stream, &(nb->misc_ops_done)); +#endif assert(CL_SUCCESS == cl_error); } else @@ -946,7 +954,11 @@ void nbnxn_gpu_launch_cpyback(gmx_nbnxn_ocl_t *nb, data back first. */ if (iloc == eintNonlocal) { +#ifdef CL_VERSION_1_2 + cl_error = clEnqueueMarkerWithWaitList(stream, 0, NULL, &(nb->nonlocal_done)); +#else cl_error = clEnqueueMarker(stream, &(nb->nonlocal_done)); +#endif assert(CL_SUCCESS == cl_error); }