diff --git a/examples/rng/device/CMakeLists.txt b/examples/rng/device/CMakeLists.txt index 1b6ecf2dd..656a6db9b 100644 --- a/examples/rng/device/CMakeLists.txt +++ b/examples/rng/device/CMakeLists.txt @@ -60,6 +60,8 @@ foreach(rng_device_source ${RNG_DEVICE_SOURCES}) ) if(NOT ${ONEMKL_SYCL_IMPLEMENTATION} STREQUAL "hipsycl") + # set strict warning flags for rng device API examples + target_compile_options(example_${domain}_${rng_device_source} PUBLIC -Wall -Werror -Wextra -Wpedantic -Wunreachable-code -Wfloat-conversion -Wextra-semi -Wshadow) target_link_options(example_${domain}_${rng_device_source} PUBLIC -fsycl -fsycl-device-code-split=per_kernel) endif() diff --git a/examples/rng/device/include/rng_example_helper.hpp b/examples/rng/device/include/rng_example_helper.hpp index 0bcf114b4..9d0811a31 100644 --- a/examples/rng/device/include/rng_example_helper.hpp +++ b/examples/rng/device/include/rng_example_helper.hpp @@ -35,7 +35,7 @@ auto get_multi_ptr(T acc) { #else return acc.get_pointer(); #endif -}; +} template ::value>::type* = nullptr> auto get_multi_ptr(T acc) { @@ -45,6 +45,6 @@ auto get_multi_ptr(T acc) { #else return acc.get_pointer(); #endif -}; +} #endif // _RNG_EXAMPLE_HELPER_HPP__ diff --git a/examples/rng/device/uniform.cpp b/examples/rng/device/uniform.cpp index a1c097bba..26bdc4b6f 100644 --- a/examples/rng/device/uniform.cpp +++ b/examples/rng/device/uniform.cpp @@ -109,7 +109,7 @@ int run_example(sycl::queue& queue) { int err = 0; Type res_host; - for (int i = 0; i < n; i++) { + for (std::size_t i = 0; i < n; i++) { res_host = oneapi::mkl::rng::device::generate(distr, engine); if (res_host != r_dev[i]) { std::cout << "error in " << i << " element " << res_host << " " << r_dev[i] diff --git a/include/oneapi/mkl/rng/device/detail/beta_impl.hpp b/include/oneapi/mkl/rng/device/detail/beta_impl.hpp index e412ee157..e7b0d1f4a 100644 --- a/include/oneapi/mkl/rng/device/detail/beta_impl.hpp +++ b/include/oneapi/mkl/rng/device/detail/beta_impl.hpp @@ -364,9 +364,8 @@ class distribution_base> { flInv = RealType(1.0) / (q_ + flW); flTmp[0] = flKoef1 * flInv; flTmp[1] = flU1 * flU1 * flU2; - for (int i = 0; i < 2; i++) { - flTmp[i] = ln_wrapper(flTmp[i]); - } + flTmp[0] = ln_wrapper(flTmp[0]); + flTmp[1] = ln_wrapper(flTmp[1]); if (flKoef1 * flTmp[0] + flKoef3 * flV - log4() >= flTmp[1]) { z[i] = flW * flInv; diff --git a/include/oneapi/mkl/rng/device/detail/uniform_impl.hpp b/include/oneapi/mkl/rng/device/detail/uniform_impl.hpp index ec50eb8fc..4117f5579 100644 --- a/include/oneapi/mkl/rng/device/detail/uniform_impl.hpp +++ b/include/oneapi/mkl/rng/device/detail/uniform_impl.hpp @@ -140,7 +140,6 @@ class distribution_base> { return generate_single_int(engine); if constexpr (EngineType::vec_size == 1) { - std::uint32_t res_1, res_2; std::uint64_t res_64, leftover; generate_leftover( @@ -270,7 +269,6 @@ class distribution_base> { return res; } - std::uint32_t res_1, res_2; std::uint64_t res_64, leftover; generate_leftover(