@@ -18,11 +18,12 @@ void THNN_(MSECriterion_updateOutput)(
1818 input = THCTensor_ (newContiguous)(state, input);
1919 target = THCTensor_ (newContiguous)(state, target);
2020
21+ THCThrustAllocator thrustAlloc (state);
2122 thrust::device_ptr<real> input_data (THCTensor_ (data)(state, input));
2223 thrust::device_ptr<real> target_data (THCTensor_ (data)(state, target));
2324 accreal sum = thrust::inner_product (
2425#if CUDA_VERSION >= 7000
25- thrust::cuda::par.on (THCState_getCurrentStream (state)),
26+ thrust::cuda::par (thrustAlloc) .on (THCState_getCurrentStream (state)),
2627#endif
2728 input_data, input_data+size, target_data, (accreal) 0 ,
2829 thrust::plus<accreal>(), mse_functor<real, accreal>());
@@ -54,13 +55,14 @@ void THNN_(MSECriterion_updateGradInput)(
5455
5556 THCTensor_ (resizeAs)(state, gradInput, input);
5657
58+ THCThrustAllocator thrustAlloc (state);
5759 thrust::device_ptr<real> input_data (THCTensor_ (data)(state, input));
5860 thrust::device_ptr<real> target_data (THCTensor_ (data)(state, target));
5961 thrust::device_ptr<real> gradInput_data (THCTensor_ (data)(state, gradInput));
6062
6163 thrust::transform (
6264#if CUDA_VERSION >= 7000
63- thrust::cuda::par.on (THCState_getCurrentStream (state)),
65+ thrust::cuda::par (thrustAlloc) .on (THCState_getCurrentStream (state)),
6466#endif
6567 input_data, input_data+size, target_data, gradInput_data,
6668 mse_updateGradInput_functor<real, accreal>(norm));
0 commit comments