From 6ada84481a465afbcf89895b5bed0e74e08742e0 Mon Sep 17 00:00:00 2001 From: pgovyadi Date: Wed, 3 Aug 2016 17:27:38 -0500 Subject: [PATCH] Reverted to 40db18bb the hard way, by overwriting the old files and pushing --- stim/cuda/cuda_texture.cuh | 18 +++++++++--------- stim/cuda/filter.cuh | 8 ++++---- stim/cuda/ivote/down_sample.cuh | 4 ++-- stim/gl/gl_spider.h | 53 +++++++++++++++++++++-------------------------------- stim/math/matrix.h | 8 ++++---- 5 files changed, 40 insertions(+), 51 deletions(-) diff --git a/stim/cuda/cuda_texture.cuh b/stim/cuda/cuda_texture.cuh index 0ae6bf3..3b5460e 100644 --- a/stim/cuda/cuda_texture.cuh +++ b/stim/cuda/cuda_texture.cuh @@ -134,15 +134,15 @@ namespace stim void UnmapCudaTexture() { - HANDLE_ERROR( - cudaGraphicsUnmapResources(1, &resource) - ); - HANDLE_ERROR( - cudaGraphicsUnregisterResource(resource) - ); - HANDLE_ERROR( - cudaDestroyTextureObject(tObj) - ); + // HANDLE_ERROR( + // cudaGraphicsUnmapResources(1, &resource) + // ); + // HANDLE_ERROR( + // cudaGraphicsUnregisterResource(resource) + // ); + // HANDLE_ERROR( + // cudaDestroyTextureObject(tObj) + // ); // HANDLE_ERROR( // cudaFreeArray(srcArray) // ); diff --git a/stim/cuda/filter.cuh b/stim/cuda/filter.cuh index 06bcb4c..0a0dbf1 100644 --- a/stim/cuda/filter.cuh +++ b/stim/cuda/filter.cuh @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -14,7 +15,6 @@ #include #define IMAD(a,b,c) ( __mul24((a), (b)) + (c) ) -#define M_PI 3.141592654f namespace stim @@ -73,7 +73,7 @@ namespace stim idx = j*kl+i; x = i - kr - 0.5; y = j - kr - 0.5; - LoG[idx] = (-1.0/M_PI/powf(sigma, 4))* (1 - (powf(x,2)+powf(y,2))/2.0/powf(sigma, 2)) + LoG[idx] = (-1.0/PI/powf(sigma, 4))* (1 - (powf(x,2)+powf(y,2))/2.0/powf(sigma, 2)) *expf(-(powf(x,2)+powf(y,2))/2/powf(sigma,2)); t +=LoG[idx]; } @@ -98,7 +98,7 @@ namespace stim int y = blockIdx.y; int xi = threadIdx.x; int yi = threadIdx.y; - float val = 0; + // float val = 0; float tu = (x-kr+xi)/(float)DIM_X; float tv = (y-kr+yi)/(float)DIM_Y; shared[xi][yi] = gpuLoG[yi*kl+xi]*(255.0-(float)tex2D(texIn, tu, tv)); @@ -111,7 +111,7 @@ namespace stim //y = min(y, height - 1); int idx = y*DIM_X+x; - int k_idx; + // int k_idx; for(unsigned int step = blockDim.x/2; step >= 1; step >>= 1) { __syncthreads(); diff --git a/stim/cuda/ivote/down_sample.cuh b/stim/cuda/ivote/down_sample.cuh index 3e26b50..bde2527 100644 --- a/stim/cuda/ivote/down_sample.cuh +++ b/stim/cuda/ivote/down_sample.cuh @@ -44,7 +44,7 @@ namespace stim{ unsigned int y_ds = (y/sigma_ds + (y %sigma_ds == 0 ? 0:1)); //get the number of pixels in the image - unsigned int pixels_ds = x_ds * y_ds; +// unsigned int pixels_ds = x_ds * y_ds; unsigned int max_threads = stim::maxThreadsPerBlock(); dim3 threads(max_threads, 1); @@ -97,4 +97,4 @@ namespace stim{ } } -#endif \ No newline at end of file +#endif diff --git a/stim/gl/gl_spider.h b/stim/gl/gl_spider.h index 6b893fa..25efd24 100644 --- a/stim/gl/gl_spider.h +++ b/stim/gl/gl_spider.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -369,7 +370,7 @@ class gl_spider : public virtual gl_texture ///Stored in a display list. ///uses the default d vector <0,0,1> void - genDirectionVectors(float solidAngle = 5/M_PI*4) + genDirectionVectors(float solidAngle = M_PI/2) { //Set up the vectors necessary for Rectangle creation. @@ -584,7 +585,7 @@ class gl_spider : public virtual gl_texture glDeleteFramebuffers(1, &framebufferID); glGenFramebuffers(1, &framebufferID); glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); - int numChannels = 1; +// int numChannels = 1; // unsigned char* texels = new unsigned char[width * height * numChannels]; glGenTextures(1, &textureID); glBindTexture(GL_TEXTURE_2D, textureID); @@ -609,7 +610,7 @@ class gl_spider : public virtual gl_texture { glGenFramebuffers(1, &fboID); glBindFramebuffer(GL_FRAMEBUFFER, fboID); - int numChannels = 1; +// int numChannels = 1; // unsigned char* texels = new unsigned char[width * height * numChannels]; glGenTextures(1, &texbufferID); glBindTexture(GL_TEXTURE_2D, texbufferID); @@ -938,7 +939,7 @@ class gl_spider : public virtual gl_texture network_time = 0; hit_time = 0; #endif - stepsize = 3.0; + stepsize = 2.5; t_length = 16.0; srand(100); @@ -1392,13 +1393,9 @@ class gl_spider : public virtual gl_texture Z[0] = cos(PHI[0]); Z[1] = cos(PHI[1]); - range = Z[0] - Z[1]; - - float z, theta, phi; - std::vector > vecsUni; for(int i = 0; i < numSamplesPos; i++) { @@ -1490,8 +1487,6 @@ class gl_spider : public virtual gl_texture void trace(int min_cost) { - bool sEmpty = true; - float lastmag = 16.0;; stim::vec3 curSeed; stim::vec3 curSeedVec; float curSeedMag; @@ -1527,7 +1522,7 @@ class gl_spider : public virtual gl_texture gpuStartTimer(); #endif - float s = 3.0; +// float s = 3.0; GLuint selectBuf[2048]; GLint hits; glSelectBuffer(2048, selectBuf); @@ -1541,17 +1536,17 @@ class gl_spider : public virtual gl_texture CHECK_OPENGL_ERROR //What would that vessel see in front of it. camSel.setPosition(loc); - camSel.setFocalDistance(mag/s); - camSel.LookAt((loc[0]+dir[0]*mag/s), - (loc[1]+dir[1]*mag/s), - (loc[2]+dir[2]*mag/s)); + camSel.setFocalDistance(mag/stepsize); + camSel.LookAt((loc[0]+dir[0]*mag/stepsize), + (loc[1]+dir[1]*mag/stepsize), + (loc[2]+dir[2]*mag/stepsize)); ps = camSel.getPosition(); ups = camSel.getUp(); ds = camSel.getLookAt(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); - glOrtho(-mag/s/2.0, mag/s/2.0, -mag/s/2.0, mag/s/2.0, 0.0, mag/s/2.0); + glOrtho(-mag/stepsize/2.0, mag/stepsize/2.0, -mag/stepsize/2.0, mag/stepsize/2.0, 0.0, mag/stepsize/2.0); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); @@ -1597,21 +1592,11 @@ class gl_spider : public virtual gl_texture int processHits(GLint hits, GLuint buffer[]) { - GLuint names, *ptr; - //printf("hits = %u\n", hits); + GLuint *ptr; ptr = (GLuint *) buffer; - // for (int i = 0; i < hits; i++) { /* for each hit */ - names = *ptr; - // printf (" number of names for hit = %u\n", names); ptr++; ptr++; //Skip the minimum depth value. ptr++; //Skip the maximum depth value. - // printf (" the name is "); - // for (int j = 0; j < names; j++) { /* for each name */ - // printf ("%u ", *ptr); ptr++; - // } - // printf ("\n"); - // } if(hits == 0) @@ -1675,11 +1660,18 @@ class gl_spider : public virtual gl_texture } #ifdef TIMING - double network_time = (std::clock() - s) / (double) CLOCKS_PER_SEC; - network_time += network_time * 1000.0; + double nt = (std::clock() - s) / (double) CLOCKS_PER_SEC; + network_time += nt * 1000.0; #endif } +// void +// addToNetwork(pair, int> in, stim::vec3 spos, +// stim::vec smag, stim::vec3 sdir) +// { +// +// } + void printSizes() @@ -1783,9 +1775,6 @@ class gl_spider : public virtual gl_texture } } } - - - }; } #endif diff --git a/stim/math/matrix.h b/stim/math/matrix.h index 64bcb28..81d24e9 100644 --- a/stim/math/matrix.h +++ b/stim/math/matrix.h @@ -53,13 +53,13 @@ struct matrix template vec operator*(vec rhs){ - unsigned int N = rhs.size(); + unsigned int M = rhs.size(); vec result; - result.resize(N); + result.resize(M); - for(int r=0; r