diff --git a/build/lib/libradar.so b/build/lib/libradar.so index 0ffbbe99a7b270f575c60c4c22909d313ecc61ea..3eb72d9760f8b82d60954d30039fdc3e58bf1aa3 100755 Binary files a/build/lib/libradar.so and b/build/lib/libradar.so differ diff --git a/lib/radar.cu b/lib/radar.cu index 65ed2ac0cb0975ab2f8e4ec77eb398b32f1a7a88..6f2e1ee548f8cd74afe369ee48561ee93b23b404 100644 --- a/lib/radar.cu +++ b/lib/radar.cu @@ -355,7 +355,7 @@ cufftHandle *fft_range_handle = new cufftHandle[NSTREAMS]; cufftHandle *fft_doppler_handle = new cufftHandle[NSTREAMS]; cufftHandle *fft_pdop_handle = new cufftHandle[NSTREAMS]; -cuFloatComplex *iqhh, *iqvv, *iqhv, *p_iqhh, *p_iqvv, *p_iqhv; +cuFloatComplex *p_iqhh, *p_iqvv, *p_iqhv; // Device buffers __constant__ float *d_hamming; @@ -365,10 +365,6 @@ float *d_result; extern "C" { void initialize() { - iqhh = new cuFloatComplex[m*n]; - iqvv = new cuFloatComplex[m*n]; - iqhv = new cuFloatComplex[m*n]; - cudaMallocHost((void**)&p_iqhh, NSTREAMS*m*n*sizeof(cuFloatComplex)); cudaMallocHost((void**)&p_iqvv, NSTREAMS*m*n*sizeof(cuFloatComplex)); cudaMallocHost((void**)&p_iqhv, NSTREAMS*m*n*sizeof(cuFloatComplex)); @@ -453,10 +449,6 @@ extern "C" { cudaFreeHost(p_iqhh); cudaFreeHost(p_iqvv); cudaFreeHost(p_iqhv); - - delete[] iqhh; - delete[] iqvv; - delete[] iqhv; } void fetch_reflectivity( @@ -466,7 +458,11 @@ extern "C" { int stream_id = sector_id % NSTREAMS; int result_offset = sector_id * (m/2) * RESULT_SIZE; - cudaStreamSynchronize(stream[stream_id]); + cudaError_t status = cudaStreamSynchronize(stream[stream_id]); + + if(status != cudaSuccess) { + printf("Processing sector #%d Failed\n", sector_id); + } for (int i=0; i<m/2; i++) { zdb[i] = result[result_offset + i * RESULT_SIZE]; @@ -482,6 +478,12 @@ extern "C" { int* i_vv, int* r_hv, int* i_hv) { + cuFloatComplex *iqhh, *iqvv, *iqhv; + + iqhh = new cuFloatComplex[m*n]; + iqvv = new cuFloatComplex[m*n]; + iqhv = new cuFloatComplex[m*n]; + int stream_id = sector_id % NSTREAMS; int offset = stream_id * (m*n); int result_offset = sector_id * (m/2)*RESULT_SIZE; @@ -583,6 +585,10 @@ extern "C" { __calcresult_v2<<<1,m/2,0,stream[stream_id]>>>(d_iqhh, d_iqvv, d_iqhv, d_result, n, offset, result_offset); cudaMemcpyAsync(&result[result_offset], &d_result[result_offset], (m/2)*RESULT_SIZE*sizeof(float), cudaMemcpyDeviceToHost, stream[stream_id]); + + delete[] iqhh; + delete[] iqvv; + delete[] iqhv; } }