 		ThetaEKernel<<<gridSize, blockSize, 0, stream>>>(*h_T, *h_RH, *h_P, *h_prevT, *h_prevRH, *h_prevP, d_maxThetaE,
 		                                                 d_Tresult, d_TDresult, d_Presult, d_found);
 
-		std::vector<unsigned char> found(N, 0);
-		CUDA_CHECK(cudaMemcpyAsync(&found[0], d_found, sizeof(unsigned char) * N, cudaMemcpyDeviceToHost, stream));
-		CUDA_CHECK(cudaStreamSynchronize(stream));
+		size_t foundCount = thrust::count(thrust::cuda::par.on(stream), dt_found, dt_found + N, 1);
 
 		if (release)
 		{

		ASSERT(Tparcel > 100. || IsMissingDouble(Tparcel));

		double prevTparcel = d_prevTparcel[idx];  // K
		ASSERT(prevTparcel > 100. || IsMissingDouble(Tparcel));

		double LFCP = d_LFCP[idx];  // hPa
		ASSERT(LFCP < 1200.);

#include <cuda_runtime.h>
#include <thrust/count.h>
#include <thrust/device_vector.h>
#include <thrust/system/cuda/execution_policy.h>

#include "plugin_factory.h"

