Fixed warnings and compilation for pyatidlas

This commit is contained in:
Philippe Tillet
2015-01-28 19:50:47 -05:00
parent e059178759
commit 04cec21752
3 changed files with 16 additions and 5 deletions

View File

@@ -30,13 +30,14 @@ string(REPLACE ";" " " BLAS_DEF_STR "${BLAS_DEF}")
foreach(PROG blas overhead)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
if(CUDA_FOUND)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Wall -Wextra ${BLAS_DEF_STR}")
set(CUPROG ${CMAKE_CURRENT_BINARY_DIR}/${PROG}.cu)
file(COPY ${PROG}.cpp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/${PROG}.cpp ${CUPROG})
cuda_add_executable(${PROG}-bench ${CUPROG})
else()
add_executable(${PROG}-bench ${PROG}.cpp)
set_target_properties(${PROG}-bench PROPERTIES COMPILE_FLAGS "-Wall -Wextra ${BLAS_DEF_STR}")
endif()
target_link_libraries(${PROG}-bench ${BLAS_LIBS})
set_target_properties(${PROG}-bench PROPERTIES COMPILE_FLAGS "-Wall -Wextra ${BLAS_DEF_STR}")
endforeach(PROG)

View File

@@ -1145,7 +1145,9 @@ static inline cl_int errHandler (
return err;
}
#else
static inline cl_int errHandler (cl_int err, const char * errStr = NULL)
static inline cl_int errHandler (cl_int err, const char * errStr = NULL);
static inline cl_int errHandler (cl_int err, const char *)
{
return err;
}

View File

@@ -178,8 +178,11 @@ namespace detail
bp::list nv_compute_capability(cl::Device const & device)
{
bp::list res;
res.append(device.getInfo<CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV>());
res.append(device.getInfo<CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV>());
cl_uint cmin, cmaj;
clGetDeviceInfo(device(), CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, sizeof(cl_uint), (cl_uint*)&cmaj, NULL);
clGetDeviceInfo(device(), CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, sizeof(cl_uint), (cl_uint*)&cmin, NULL);
res.append(cmaj);
res.append(cmin);
return res;
}
@@ -304,6 +307,10 @@ namespace detail
if(type==CL_DEVICE_TYPE_ACCELERATOR) return "ACCELERATOR";
throw;
}
boost::shared_ptr<cl::Context> make_context(cl::Device const & dev)
{ return boost::shared_ptr<cl::Context>(new cl::Context(std::vector<cl::Device>(1, dev))); }
}
@@ -351,7 +358,8 @@ void export_cl()
#undef WRAP
;
bp::class_<cl::Context>("context", bp::init<cl::Device>())
bp::class_<cl::Context>("context", bp::no_init)
.def("__init__", bp::make_constructor(&detail::make_context))
#define WRAP(PYNAME, NAME) .add_property(PYNAME, &detail::wrap_context_info<NAME>)
#undef WRAP
.add_property("queues", bp::make_function(&detail::get_queue, bp::return_internal_reference<>()))