Commit 5a5359dae3c59cd9b506ac171675c0a59a93c176

Authored by David Mayerich
1 parent c6f526c2

fixed - allows the use of masks for cuBLAS calculated covariance matrices

Showing 1 changed file with 7 additions and 4 deletions   Show diff stats
stim/envi/bip.h
... ... @@ -1041,11 +1041,14 @@ public:
1041 1041 return EXIT_FAILURE;
1042 1042 }
1043 1043 for (unsigned long long xy = 0; xy < XY; xy++){ //for each pixel
1044   - pixeld(s, xy); //retreive the spectrum at the current xy pixel location
1045   - stat = cublasSetVector(B, sizeof(double), s, 1, s_dev, 1); //copy the spectrum from the host to the device
1046   - stat = cublasDaxpy(handle, B, &axpy_alpha, avg_dev, 1, s_dev, 1); //subtract the average spectrum
1047   - stat = cublasDsyr(handle, CUBLAS_FILL_MODE_UPPER, B, &ger_alpha, s_dev, 1, A_dev, B); //calculate the covariance matrix (symmetric outer product)
  1044 + if (mask == NULL || mask[xy] != 0){
  1045 + pixeld(s, xy); //retreive the spectrum at the current xy pixel location
  1046 + stat = cublasSetVector(B, sizeof(double), s, 1, s_dev, 1); //copy the spectrum from the host to the device
  1047 + stat = cublasDaxpy(handle, B, &axpy_alpha, avg_dev, 1, s_dev, 1); //subtract the average spectrum
  1048 + stat = cublasDsyr(handle, CUBLAS_FILL_MODE_UPPER, B, &ger_alpha, s_dev, 1, A_dev, B); //calculate the covariance matrix (symmetric outer product)
  1049 + }
1048 1050 thread_data = (double)xy / XY * 100; //record the current progress
  1051 +
1049 1052 }
1050 1053  
1051 1054 cublasGetMatrix(B, B, sizeof(double), A_dev, B, co, B); //copy the result from the GPU to the CPU
... ...