Commit 683f216a3526af2a8839057a4c505661a3f40af0

Authored by David Mayerich
1 parent d24662d2

fixed? Linux compiler errors

stim/envi/binary.h
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 #include <unistd.h> 15 #include <unistd.h>
16 #endif 16 #endif
17 17
18 -#ifdef CUDA_FOUND 18 +#ifdef USE_CUDA
19 //CUDA externs 19 //CUDA externs
20 void gpu_permute(char* dest, char* src, size_t sx, size_t sy, size_t sz, size_t d0, size_t d1, size_t d2, size_t typesize); 20 void gpu_permute(char* dest, char* src, size_t sx, size_t sy, size_t sz, size_t d0, size_t d1, size_t d2, size_t typesize);
21 #include <stim/cuda/cudatools/error.h> 21 #include <stim/cuda/cudatools/error.h>
@@ -647,7 +647,7 @@ public: @@ -647,7 +647,7 @@ public:
647 std::chrono::high_resolution_clock::time_point t0, t1; 647 std::chrono::high_resolution_clock::time_point t0, t1;
648 t0 = std::chrono::high_resolution_clock::now(); 648 t0 = std::chrono::high_resolution_clock::now();
649 649
650 -#ifdef CUDA_FOUND 650 +#ifdef USE_CUDA
651 T* gpu_src; 651 T* gpu_src;
652 HANDLE_ERROR( cudaMalloc(&gpu_src, sx*sy*sz*sizeof(T)) ); 652 HANDLE_ERROR( cudaMalloc(&gpu_src, sx*sy*sz*sizeof(T)) );
653 HANDLE_ERROR( cudaMemcpy(gpu_src, src, sx*sy*sz*sizeof(T), cudaMemcpyHostToDevice) ); 653 HANDLE_ERROR( cudaMemcpy(gpu_src, src, sx*sy*sz*sizeof(T), cudaMemcpyHostToDevice) );
stim/image/image.h
@@ -141,7 +141,7 @@ public: @@ -141,7 +141,7 @@ public:
141 141
142 //save a Netpbm file 142 //save a Netpbm file
143 void load_netpbm(std::string filename) { 143 void load_netpbm(std::string filename) {
144 - std::ifstream infile(filename, std::ios::in | std::ios::binary); //open an output file 144 + std::ifstream infile(filename.c_str(), std::ios::in | std::ios::binary); //open an output file
145 if (!infile) { 145 if (!infile) {
146 std::cout << "Error opening input file in image::load_netpbm()" << std::endl; 146 std::cout << "Error opening input file in image::load_netpbm()" << std::endl;
147 exit(1); 147 exit(1);
@@ -244,7 +244,7 @@ public: @@ -244,7 +244,7 @@ public:
244 244
245 //save a Netpbm file 245 //save a Netpbm file
246 void save_netpbm(std::string filename) { 246 void save_netpbm(std::string filename) {
247 - std::ofstream outfile(filename, std::ios::out | std::ios::binary); //open an output file 247 + std::ofstream outfile(filename.c_str(), std::ios::out | std::ios::binary); //open an output file
248 if(!outfile) { 248 if(!outfile) {
249 std::cout << "Error generating output file in image::save_netpbm()" << std::endl; 249 std::cout << "Error generating output file in image::save_netpbm()" << std::endl;
250 exit(1); 250 exit(1);
@@ -356,8 +356,8 @@ public: @@ -356,8 +356,8 @@ public:
356 } 356 }
357 357
358 /// Returns an std::vector containing each channel as a separate image 358 /// Returns an std::vector containing each channel as a separate image
359 - std::vector<image<T>> split() const {  
360 - std::vector<image<T>> r; //create an image array 359 + std::vector< image<T> > split() const {
  360 + std::vector< image<T> > r; //create an image array
361 r.resize(C()); //create images for each channel 361 r.resize(C()); //create images for each channel
362 362
363 for (size_t c = 0; c < C(); c++) { //for each channel 363 for (size_t c = 0; c < C(); c++) { //for each channel
@@ -367,7 +367,7 @@ public: @@ -367,7 +367,7 @@ public:
367 } 367 }
368 368
369 /// Merge a series of single-channel images into a multi-channel image 369 /// Merge a series of single-channel images into a multi-channel image
370 - void merge(std::vector<image<T>>& list) { 370 + void merge(std::vector< image<T> >& list) {
371 size_t x = list[0].width(); //calculate the size of the image 371 size_t x = list[0].width(); //calculate the size of the image
372 size_t y = list[0].height(); 372 size_t y = list[0].height();
373 allocate(x, y, list.size()); //re-allocate the image 373 allocate(x, y, list.size()); //re-allocate the image
stim/math/filters/conv2.h
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 namespace stim { 10 namespace stim {
11 #ifdef __CUDACC__ 11 #ifdef __CUDACC__
12 //Kernel function that performs the 2D convolution. 12 //Kernel function that performs the 2D convolution.
13 - template<typename T, typename K = T> 13 + template<typename T, typename K>
14 __global__ void kernel_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) { 14 __global__ void kernel_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) {
15 extern __shared__ T s[]; //declare a shared memory array 15 extern __shared__ T s[]; //declare a shared memory array
16 size_t xi = blockIdx.x * blockDim.x + threadIdx.x; //threads correspond to indices into the output image 16 size_t xi = blockIdx.x * blockDim.x + threadIdx.x; //threads correspond to indices into the output image
@@ -52,7 +52,7 @@ namespace stim { @@ -52,7 +52,7 @@ namespace stim {
52 //@param sy is the size of the input image along Y 52 //@param sy is the size of the input image along Y
53 //@param kx is the size of the kernel along X 53 //@param kx is the size of the kernel along X
54 //@param ky is the size of the kernel along Y 54 //@param ky is the size of the kernel along Y
55 - template<typename T, typename K = T> 55 + template<typename T, typename K>
56 void gpu_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) { 56 void gpu_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) {
57 cudaDeviceProp p; 57 cudaDeviceProp p;
58 HANDLE_ERROR(cudaGetDeviceProperties(&p, 0)); 58 HANDLE_ERROR(cudaGetDeviceProperties(&p, 0));
@@ -77,7 +77,7 @@ namespace stim { @@ -77,7 +77,7 @@ namespace stim {
77 //@param sy is the size of the input image along Y 77 //@param sy is the size of the input image along Y
78 //@param kx is the size of the kernel along X 78 //@param kx is the size of the kernel along X
79 //@param ky is the size of the kernel along Y 79 //@param ky is the size of the kernel along Y
80 - template<typename T, typename K = T> 80 + template<typename T, typename K>
81 void cpu_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) { 81 void cpu_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) {
82 size_t X = sx - kx + 1; //x size of the output image 82 size_t X = sx - kx + 1; //x size of the output image
83 size_t Y = sy - ky + 1; //y size of the output image 83 size_t Y = sy - ky + 1; //y size of the output image
stim/math/filters/gauss2.h
@@ -16,7 +16,7 @@ namespace stim { @@ -16,7 +16,7 @@ namespace stim {
16 ///@param stdx is the standard deviation (in pixels) along the x axis 16 ///@param stdx is the standard deviation (in pixels) along the x axis
17 ///@param stdy is the standard deviation (in pixels) along the y axis 17 ///@param stdy is the standard deviation (in pixels) along the y axis
18 ///@param nstds specifies the number of standard deviations of the Gaussian that will be kept in the kernel 18 ///@param nstds specifies the number of standard deviations of the Gaussian that will be kept in the kernel
19 - template<typename T, typename K = T> 19 + template<typename T, typename K>
20 stim::image<T> cpu_gauss2(const stim::image<T>& in, K stdx, K stdy, size_t nstds = 3) { 20 stim::image<T> cpu_gauss2(const stim::image<T>& in, K stdx, K stdy, size_t nstds = 3) {
21 size_t kx = stdx * nstds * 2; //calculate the kernel sizes 21 size_t kx = stdx * nstds * 2; //calculate the kernel sizes
22 size_t ky = stdy * nstds * 2; 22 size_t ky = stdy * nstds * 2;
@@ -33,8 +33,8 @@ namespace stim { @@ -33,8 +33,8 @@ namespace stim {
33 for (size_t yi = 0; yi < ky; yi++) 33 for (size_t yi = 0; yi < ky; yi++)
34 gy[yi] = gauss1d((K)yi, muy, stdy); 34 gy[yi] = gauss1d((K)yi, muy, stdy);
35 35
36 - std::vector<stim::image<T>> IN = in.split(); //split the input image into channels  
37 - std::vector<stim::image<T>> R = r.split(); //split the output image into channels 36 + std::vector< stim::image<T> > IN = in.split(); //split the input image into channels
  37 + std::vector< stim::image<T> > R = r.split(); //split the output image into channels
38 for (size_t c = 0; c < in.channels(); c++) //for each channel 38 for (size_t c = 0; c < in.channels(); c++) //for each channel
39 cpu_sepconv2(R[c].data(), IN[c].data(), gx, gy, IN[c].width(), IN[c].height(), kx, ky); 39 cpu_sepconv2(R[c].data(), IN[c].data(), gx, gy, IN[c].width(), IN[c].height(), kx, ky);
40 40
stim/math/filters/sepconv2.h
@@ -15,7 +15,7 @@ namespace stim { @@ -15,7 +15,7 @@ namespace stim {
15 //@param sy is the size of the input image along Y 15 //@param sy is the size of the input image along Y
16 //@param kx is the size of the kernel along X 16 //@param kx is the size of the kernel along X
17 //@param ky is the size of the kernel along Y 17 //@param ky is the size of the kernel along Y
18 - template<typename T, typename K = T> 18 + template<typename T, typename K>
19 void gpu_sepconv2(T* out, T* in, K* k0, K* k1, size_t sx, size_t sy, size_t kx, size_t ky) { 19 void gpu_sepconv2(T* out, T* in, K* k0, K* k1, size_t sx, size_t sy, size_t kx, size_t ky) {
20 cudaDeviceProp p; 20 cudaDeviceProp p;
21 HANDLE_ERROR(cudaGetDeviceProperties(&p, 0)); 21 HANDLE_ERROR(cudaGetDeviceProperties(&p, 0));
@@ -54,7 +54,7 @@ namespace stim { @@ -54,7 +54,7 @@ namespace stim {
54 //@param sy is the size of the input image along Y 54 //@param sy is the size of the input image along Y
55 //@param kx is the size of the kernel along X 55 //@param kx is the size of the kernel along X
56 //@param ky is the size of the kernel along Y 56 //@param ky is the size of the kernel along Y
57 - template<typename T, typename K = T> 57 + template<typename T, typename K>
58 void cpu_sepconv2(T* out, T* in, K* k0, K* k1, size_t sx, size_t sy, size_t kx, size_t ky) { 58 void cpu_sepconv2(T* out, T* in, K* k0, K* k1, size_t sx, size_t sy, size_t kx, size_t ky) {
59 size_t X = sx - kx + 1; //x size of the output image 59 size_t X = sx - kx + 1; //x size of the output image
60 size_t Y = sy - ky + 1; 60 size_t Y = sy - ky + 1;