diff --git a/stim/envi/agilent_binary.h b/stim/envi/agilent_binary.h index 1dc5cbf..95a38c5 100644 --- a/stim/envi/agilent_binary.h +++ b/stim/envi/agilent_binary.h @@ -171,7 +171,7 @@ public: //pads to the nearest power-of-two void zeropad(){ - size_t newZ = pow(2, ceil(log(R[2])/log(2))); //find the nearest power-of-two + size_t newZ = (size_t)pow(2, ceil(log(R[2])/log(2))); //find the nearest power-of-two size_t n = newZ - R[2]; //calculate the number of bands to add zeropad(n); //add the padding } diff --git a/stim/envi/bil.h b/stim/envi/bil.h index cd6450f..1b8a747 100644 --- a/stim/envi/bil.h +++ b/stim/envi/bil.h @@ -243,7 +243,7 @@ public: //load a frame y into a pre-allocated double-precision array int read_plane_xzd(double* f, size_t y){ - size_t XB = X() * B(); + size_t XB = X() * Z(); T* temp = (T*) malloc(XB * sizeof(T)); //create a temporary location to store the plane at current precision if(!read_plane_y(temp, y)) return 1; //read the plane in its native format, if it fails return a 1 for(size_t i = 0; i < XB; i++) f[i] = temp[i]; //convert the plane to a double @@ -1061,7 +1061,6 @@ public: } int co_matrix_cublas(double* co, double* avg, unsigned char *mask, bool PROGRESS = false){ - cudaError_t cudaStat; cublasStatus_t stat; cublasHandle_t handle; @@ -1131,13 +1130,30 @@ public: progress = 0; int dev_count; - cudaGetDeviceCount(&dev_count); //get the number of CUDA devices + HANDLE_ERROR(cudaGetDeviceCount(&dev_count)); //get the number of CUDA devices + std::cout<<"Number of CUDA devices: "< best_device_cc){ + best_device_cc = cc; //if this is better than the previous device, use it + best_device_id = d; + } + } + if(dev_count > 0 && prop.major != 9999){ //if the first device is not an emulator + std::cout<<"Using device "< best_device_cc){ + best_device_cc = cc; //if this is better than the previous device, use it + best_device_id = d; + } + } + if(dev_count > 0 && prop.major != 9999){ //if the first device is not an emulator + std::cout<<"Using device "< best_device_cc){ + best_device_cc = cc; //if this is better than the previous device, use it + best_device_id = d; + } + } + if(dev_count > 0 && prop.major != 9999){ //if the first device is not an emulator + std::cout<<"Using device "< 0 && prop.major != 9999) //if the first device is not an emulator - // return coNoise_matrix_cublas(coN, avg, mask, PROGRESS); //use cuBLAS to calculate the covariance matrix -//#endif - - + + std::cout<<"cuBLAS initialization failed - using CPU"< sy/2 && yi < Y() - sy/2){ size_t cx = xi - sx/2; //calculate the corner position for the subimage size_t cy = yi - sy/2; - size_t cxi, cyi; for(size_t syi = 0; syi < sy; syi++){ //for each line in the subimage size_t src_i = (cy + syi) * X() + cx; //size_t dst_i = syi * (N * sx) + n * sx; -- libgit2 0.21.4