@@ -548,27 +548,9 @@ void dpnp_rng_multivariate_normal_c(void* result,
548548 // `size1` is a number of random values to be generated for each dimension.
549549 size_t size1 = size / dimen;
550550
551- if (dpnp_queue_is_cpu_c ())
552- {
553- mkl_rng::gaussian_mv<_DataType> distribution (dimen, mean, cov);
554- auto event_out = mkl_rng::generate (distribution, DPNP_RNG_ENGINE, size1, result1);
555- event_out.wait ();
556- }
557- else
558- {
559- int errcode = vdRngGaussianMV (VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER2,
560- get_rng_stream (),
561- size1,
562- result1,
563- dimen,
564- VSL_MATRIX_STORAGE_FULL,
565- mean_vector,
566- cov_vector);
567- if (errcode != VSL_STATUS_OK)
568- {
569- throw std::runtime_error (" DPNP RNG Error: dpnp_rng_multivariate_normal_c() failed." );
570- }
571- }
551+ mkl_rng::gaussian_mv<_DataType> distribution (dimen, mean, cov);
552+ auto event_out = mkl_rng::generate (distribution, DPNP_RNG_ENGINE, size1, result1);
553+ event_out.wait ();
572554}
573555
574556template <typename _DataType>
@@ -1086,11 +1068,10 @@ void dpnp_rng_standard_normal_c(void* result, size_t size)
10861068template <typename _DataType>
10871069void dpnp_rng_standard_t_c (void * result, const _DataType df, const size_t size)
10881070{
1089- if (!size)
1071+ if (!size || !result )
10901072 {
10911073 return ;
10921074 }
1093- cl::sycl::vector_class<cl::sycl::event> no_deps;
10941075
10951076 _DataType* result1 = reinterpret_cast <_DataType*>(result);
10961077 const _DataType d_zero = 0.0 , d_one = 1.0 ;
@@ -1100,18 +1081,17 @@ void dpnp_rng_standard_t_c(void* result, const _DataType df, const size_t size)
11001081 if (dpnp_queue_is_cpu_c ())
11011082 {
11021083 mkl_rng::gamma<_DataType> gamma_distribution (shape, d_zero, 1.0 / shape);
1103- auto event_out = mkl_rng::generate (gamma_distribution, DPNP_RNG_ENGINE, size, result1);
1104- event_out.wait ();
1105- event_out = mkl_vm::invsqrt (DPNP_QUEUE, size, result1, result1, no_deps, mkl_vm::mode::ha);
1106- event_out.wait ();
1084+ auto gamma_distr_event = mkl_rng::generate (gamma_distribution, DPNP_RNG_ENGINE, size, result1);
1085+
1086+ auto invsqrt_event = mkl_vm::invsqrt (DPNP_QUEUE, size, result1, result1, {gamma_distr_event}, mkl_vm::mode::ha);
11071087
11081088 sn = reinterpret_cast <_DataType*>(dpnp_memory_alloc_c (size * sizeof (_DataType)));
11091089
11101090 mkl_rng::gaussian<_DataType> gaussian_distribution (d_zero, d_one);
1111- event_out = mkl_rng::generate (gaussian_distribution, DPNP_RNG_ENGINE, size, sn);
1112- event_out.wait ();
1091+ auto gaussian_distr_event = mkl_rng::generate (gaussian_distribution, DPNP_RNG_ENGINE, size, sn);
11131092
1114- event_out = mkl_vm::mul (DPNP_QUEUE, size, result1, sn, result1, no_deps, mkl_vm::mode::ha);
1093+ auto event_out = mkl_vm::mul (
1094+ DPNP_QUEUE, size, result1, sn, result1, {invsqrt_event, gaussian_distr_event}, mkl_vm::mode::ha);
11151095 dpnp_memory_free_c (sn);
11161096 event_out.wait ();
11171097 }
0 commit comments