Commit 683f216a3526af2a8839057a4c505661a3f40af0

Authored by David Mayerich
1 parent d24662d2

fixed? Linux compiler errors

stim/envi/binary.h
... ... @@ -15,7 +15,7 @@
15 15 #include <unistd.h>
16 16 #endif
17 17  
18   -#ifdef CUDA_FOUND
  18 +#ifdef USE_CUDA
19 19 //CUDA externs
20 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 21 #include <stim/cuda/cudatools/error.h>
... ... @@ -647,7 +647,7 @@ public:
647 647 std::chrono::high_resolution_clock::time_point t0, t1;
648 648 t0 = std::chrono::high_resolution_clock::now();
649 649  
650   -#ifdef CUDA_FOUND
  650 +#ifdef USE_CUDA
651 651 T* gpu_src;
652 652 HANDLE_ERROR( cudaMalloc(&gpu_src, sx*sy*sz*sizeof(T)) );
653 653 HANDLE_ERROR( cudaMemcpy(gpu_src, src, sx*sy*sz*sizeof(T), cudaMemcpyHostToDevice) );
... ...
stim/image/image.h
... ... @@ -141,7 +141,7 @@ public:
141 141  
142 142 //save a Netpbm file
143 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 145 if (!infile) {
146 146 std::cout << "Error opening input file in image::load_netpbm()" << std::endl;
147 147 exit(1);
... ... @@ -244,7 +244,7 @@ public:
244 244  
245 245 //save a Netpbm file
246 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 248 if(!outfile) {
249 249 std::cout << "Error generating output file in image::save_netpbm()" << std::endl;
250 250 exit(1);
... ... @@ -356,8 +356,8 @@ public:
356 356 }
357 357  
358 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 361 r.resize(C()); //create images for each channel
362 362  
363 363 for (size_t c = 0; c < C(); c++) { //for each channel
... ... @@ -367,7 +367,7 @@ public:
367 367 }
368 368  
369 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 371 size_t x = list[0].width(); //calculate the size of the image
372 372 size_t y = list[0].height();
373 373 allocate(x, y, list.size()); //re-allocate the image
... ...
stim/math/filters/conv2.h
... ... @@ -10,7 +10,7 @@
10 10 namespace stim {
11 11 #ifdef __CUDACC__
12 12 //Kernel function that performs the 2D convolution.
13   - template<typename T, typename K = T>
  13 + template<typename T, typename K>
14 14 __global__ void kernel_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) {
15 15 extern __shared__ T s[]; //declare a shared memory array
16 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 52 //@param sy is the size of the input image along Y
53 53 //@param kx is the size of the kernel along X
54 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 56 void gpu_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) {
57 57 cudaDeviceProp p;
58 58 HANDLE_ERROR(cudaGetDeviceProperties(&p, 0));
... ... @@ -77,7 +77,7 @@ namespace stim {
77 77 //@param sy is the size of the input image along Y
78 78 //@param kx is the size of the kernel along X
79 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 81 void cpu_conv2(T* out, T* in, K* kernel, size_t sx, size_t sy, size_t kx, size_t ky) {
82 82 size_t X = sx - kx + 1; //x size of the output image
83 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 16 ///@param stdx is the standard deviation (in pixels) along the x axis
17 17 ///@param stdy is the standard deviation (in pixels) along the y axis
18 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 20 stim::image<T> cpu_gauss2(const stim::image<T>& in, K stdx, K stdy, size_t nstds = 3) {
21 21 size_t kx = stdx * nstds * 2; //calculate the kernel sizes
22 22 size_t ky = stdy * nstds * 2;
... ... @@ -33,8 +33,8 @@ namespace stim {
33 33 for (size_t yi = 0; yi < ky; yi++)
34 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 38 for (size_t c = 0; c < in.channels(); c++) //for each channel
39 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 15 //@param sy is the size of the input image along Y
16 16 //@param kx is the size of the kernel along X
17 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 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 20 cudaDeviceProp p;
21 21 HANDLE_ERROR(cudaGetDeviceProperties(&p, 0));
... ... @@ -54,7 +54,7 @@ namespace stim {
54 54 //@param sy is the size of the input image along Y
55 55 //@param kx is the size of the kernel along X
56 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 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 59 size_t X = sx - kx + 1; //x size of the output image
60 60 size_t Y = sy - ky + 1;
... ...