[hamradio-commits] [gnss-sdr] 17/22: cuda multicorrelator bug correction
Carles Fernandez
carles_fernandez-guest at moszumanska.debian.org
Thu Jun 30 20:11:29 UTC 2016
This is an automated email from the git hooks/post-receive script.
carles_fernandez-guest pushed a commit to branch next
in repository gnss-sdr.
commit 6cdca3b269124b33b4061852594da3e87dce9a94
Author: Javier <jarribas at cttc.es>
Date: Fri Jun 17 17:35:19 2016 +0200
cuda multicorrelator bug correction
---
src/algorithms/tracking/libs/cuda_multicorrelator.cu | 12 ++++++++----
src/algorithms/tracking/libs/cuda_multicorrelator.h | 1 +
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/algorithms/tracking/libs/cuda_multicorrelator.cu b/src/algorithms/tracking/libs/cuda_multicorrelator.cu
index 78c3612..56cea6e 100644
--- a/src/algorithms/tracking/libs/cuda_multicorrelator.cu
+++ b/src/algorithms/tracking/libs/cuda_multicorrelator.cu
@@ -160,7 +160,8 @@ bool cuda_multicorrelator::init_cuda_integrated_resampler(
//cudaSetDevice(max_device);
//set random device!
- cudaSetDevice(rand() % num_devices); //generates a random number between 0 and num_devices to split the threads between GPUs
+ selected_gps_device=rand() % num_devices;//generates a random number between 0 and num_devices to split the threads between GPUs
+ cudaSetDevice(selected_gps_device);
cudaGetDeviceProperties( &prop, max_device );
//debug code
@@ -174,9 +175,8 @@ bool cuda_multicorrelator::init_cuda_integrated_resampler(
printf("deviceOverlap= %i \n",prop.deviceOverlap);
printf("multiProcessorCount= %i \n",prop.multiProcessorCount);
}else{
- int whichDevice;
- cudaGetDevice( &whichDevice );
- cudaGetDeviceProperties( &prop, whichDevice );
+ cudaGetDevice( &selected_gps_device);
+ cudaGetDeviceProperties( &prop, selected_gps_device );
//debug code
if (prop.canMapHostMemory != 1) {
printf( "Device can not map memory.\n" );
@@ -242,6 +242,8 @@ bool cuda_multicorrelator::set_local_code_and_taps(
int n_correlators
)
{
+
+ cudaSetDevice(selected_gps_device);
//********* ZERO COPY VERSION ************
// // Get device pointer from host memory. No allocation or memcpy
// cudaError_t code;
@@ -276,6 +278,7 @@ bool cuda_multicorrelator::set_input_output_vectors(
)
{
+ cudaSetDevice(selected_gps_device);
// Save CPU pointers
d_sig_in_cpu =sig_in;
d_corr_out_cpu = corr_out;
@@ -312,6 +315,7 @@ bool cuda_multicorrelator::Carrier_wipeoff_multicorrelator_resampler_cuda(
int n_correlators)
{
+ cudaSetDevice(selected_gps_device);
// cudaMemCpy version
//size_t memSize = signal_length_samples * sizeof(std::complex<float>);
// input signal CPU -> GPU copy memory
diff --git a/src/algorithms/tracking/libs/cuda_multicorrelator.h b/src/algorithms/tracking/libs/cuda_multicorrelator.h
index 4b11f85..10b8913 100644
--- a/src/algorithms/tracking/libs/cuda_multicorrelator.h
+++ b/src/algorithms/tracking/libs/cuda_multicorrelator.h
@@ -157,6 +157,7 @@ private:
float *d_shifts_chips;
int d_code_length_chips;
+ int selected_gps_device;
int threadsPerBlock;
int blocksPerGrid;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git
More information about the pkg-hamradio-commits
mailing list