Commit 0730bd0415d46852d166ba3c97955996fc32b19c

Authored by Pavel Govyadinov
1 parent 087cecd2

Revert "removed some unused variables that cause the generation of warnings"

This reverts commit 9474c2835439c325ea2025a94879f7b311830f61.
stim/cuda/cuda_texture.cuh
@@ -134,15 +134,15 @@ namespace stim @@ -134,15 +134,15 @@ namespace stim
134 void 134 void
135 UnmapCudaTexture() 135 UnmapCudaTexture()
136 { 136 {
137 - // HANDLE_ERROR(  
138 - // cudaGraphicsUnmapResources(1, &resource)  
139 - // );  
140 - // HANDLE_ERROR(  
141 - // cudaGraphicsUnregisterResource(resource)  
142 - // );  
143 - // HANDLE_ERROR(  
144 - // cudaDestroyTextureObject(tObj)  
145 - // ); 137 + HANDLE_ERROR(
  138 + cudaGraphicsUnmapResources(1, &resource)
  139 + );
  140 + HANDLE_ERROR(
  141 + cudaGraphicsUnregisterResource(resource)
  142 + );
  143 + HANDLE_ERROR(
  144 + cudaDestroyTextureObject(tObj)
  145 + );
146 // HANDLE_ERROR( 146 // HANDLE_ERROR(
147 // cudaFreeArray(srcArray) 147 // cudaFreeArray(srcArray)
148 // ); 148 // );
stim/cuda/filter.cuh
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <stim/visualization/colormap.h> 8 #include <stim/visualization/colormap.h>
9 #include <sstream> 9 #include <sstream>
10 -#include <stim/math/constants.h>  
11 #include <stim/cuda/cudatools/devices.h> 10 #include <stim/cuda/cudatools/devices.h>
12 #include <stim/cuda/cudatools/threads.h> 11 #include <stim/cuda/cudatools/threads.h>
13 #include <stim/cuda/cuda_texture.cuh> 12 #include <stim/cuda/cuda_texture.cuh>
@@ -15,6 +14,7 @@ @@ -15,6 +14,7 @@
15 #include <stim/cuda/arraymath.cuh> 14 #include <stim/cuda/arraymath.cuh>
16 15
17 #define IMAD(a,b,c) ( __mul24((a), (b)) + (c) ) 16 #define IMAD(a,b,c) ( __mul24((a), (b)) + (c) )
  17 +#define M_PI 3.141592654f
18 18
19 19
20 namespace stim 20 namespace stim
@@ -73,7 +73,7 @@ namespace stim @@ -73,7 +73,7 @@ namespace stim
73 idx = j*kl+i; 73 idx = j*kl+i;
74 x = i - kr - 0.5; 74 x = i - kr - 0.5;
75 y = j - kr - 0.5; 75 y = j - kr - 0.5;
76 - LoG[idx] = (-1.0/PI/powf(sigma, 4))* (1 - (powf(x,2)+powf(y,2))/2.0/powf(sigma, 2)) 76 + LoG[idx] = (-1.0/M_PI/powf(sigma, 4))* (1 - (powf(x,2)+powf(y,2))/2.0/powf(sigma, 2))
77 *expf(-(powf(x,2)+powf(y,2))/2/powf(sigma,2)); 77 *expf(-(powf(x,2)+powf(y,2))/2/powf(sigma,2));
78 t +=LoG[idx]; 78 t +=LoG[idx];
79 } 79 }
@@ -98,7 +98,7 @@ namespace stim @@ -98,7 +98,7 @@ namespace stim
98 int y = blockIdx.y; 98 int y = blockIdx.y;
99 int xi = threadIdx.x; 99 int xi = threadIdx.x;
100 int yi = threadIdx.y; 100 int yi = threadIdx.y;
101 - // float val = 0; 101 + float val = 0;
102 float tu = (x-kr+xi)/(float)DIM_X; 102 float tu = (x-kr+xi)/(float)DIM_X;
103 float tv = (y-kr+yi)/(float)DIM_Y; 103 float tv = (y-kr+yi)/(float)DIM_Y;
104 shared[xi][yi] = gpuLoG[yi*kl+xi]*(255.0-(float)tex2D<unsigned char>(texIn, tu, tv)); 104 shared[xi][yi] = gpuLoG[yi*kl+xi]*(255.0-(float)tex2D<unsigned char>(texIn, tu, tv));
@@ -111,7 +111,7 @@ namespace stim @@ -111,7 +111,7 @@ namespace stim
111 //y = min(y, height - 1); 111 //y = min(y, height - 1);
112 112
113 int idx = y*DIM_X+x; 113 int idx = y*DIM_X+x;
114 - // int k_idx; 114 + int k_idx;
115 for(unsigned int step = blockDim.x/2; step >= 1; step >>= 1) 115 for(unsigned int step = blockDim.x/2; step >= 1; step >>= 1)
116 { 116 {
117 __syncthreads(); 117 __syncthreads();
stim/cuda/ivote/down_sample.cuh
@@ -44,7 +44,7 @@ namespace stim{ @@ -44,7 +44,7 @@ namespace stim{
44 unsigned int y_ds = (y/sigma_ds + (y %sigma_ds == 0 ? 0:1)); 44 unsigned int y_ds = (y/sigma_ds + (y %sigma_ds == 0 ? 0:1));
45 45
46 //get the number of pixels in the image 46 //get the number of pixels in the image
47 -// unsigned int pixels_ds = x_ds * y_ds; 47 + unsigned int pixels_ds = x_ds * y_ds;
48 48
49 unsigned int max_threads = stim::maxThreadsPerBlock(); 49 unsigned int max_threads = stim::maxThreadsPerBlock();
50 dim3 threads(max_threads, 1); 50 dim3 threads(max_threads, 1);
@@ -97,4 +97,4 @@ namespace stim{ @@ -97,4 +97,4 @@ namespace stim{
97 } 97 }
98 } 98 }
99 99
100 -#endif 100 -#endif
  101 +#endif
101 \ No newline at end of file 102 \ No newline at end of file
stim/gl/gl_spider.h
@@ -14,7 +14,6 @@ @@ -14,7 +14,6 @@
14 #include <stim/math/vec3.h> 14 #include <stim/math/vec3.h>
15 #include <stim/math/rect.h> 15 #include <stim/math/rect.h>
16 #include <stim/math/matrix.h> 16 #include <stim/math/matrix.h>
17 -#include <stim/math/constants.h>  
18 #include <stim/cuda/spider_cost.cuh> 17 #include <stim/cuda/spider_cost.cuh>
19 #include <stim/cuda/cudatools/glbind.h> 18 #include <stim/cuda/cudatools/glbind.h>
20 #include <stim/cuda/arraymath.cuh> 19 #include <stim/cuda/arraymath.cuh>
@@ -370,7 +369,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -370,7 +369,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
370 ///Stored in a display list. 369 ///Stored in a display list.
371 ///uses the default d vector <0,0,1> 370 ///uses the default d vector <0,0,1>
372 void 371 void
373 - genDirectionVectors(float solidAngle = M_PI/2) 372 + genDirectionVectors(float solidAngle = 5/M_PI*4)
374 { 373 {
375 374
376 //Set up the vectors necessary for Rectangle creation. 375 //Set up the vectors necessary for Rectangle creation.
@@ -585,7 +584,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -585,7 +584,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
585 glDeleteFramebuffers(1, &framebufferID); 584 glDeleteFramebuffers(1, &framebufferID);
586 glGenFramebuffers(1, &framebufferID); 585 glGenFramebuffers(1, &framebufferID);
587 glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 586 glBindFramebuffer(GL_FRAMEBUFFER, framebufferID);
588 -// int numChannels = 1; 587 + int numChannels = 1;
589 // unsigned char* texels = new unsigned char[width * height * numChannels]; 588 // unsigned char* texels = new unsigned char[width * height * numChannels];
590 glGenTextures(1, &textureID); 589 glGenTextures(1, &textureID);
591 glBindTexture(GL_TEXTURE_2D, textureID); 590 glBindTexture(GL_TEXTURE_2D, textureID);
@@ -610,7 +609,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -610,7 +609,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
610 { 609 {
611 glGenFramebuffers(1, &fboID); 610 glGenFramebuffers(1, &fboID);
612 glBindFramebuffer(GL_FRAMEBUFFER, fboID); 611 glBindFramebuffer(GL_FRAMEBUFFER, fboID);
613 -// int numChannels = 1; 612 + int numChannels = 1;
614 // unsigned char* texels = new unsigned char[width * height * numChannels]; 613 // unsigned char* texels = new unsigned char[width * height * numChannels];
615 glGenTextures(1, &texbufferID); 614 glGenTextures(1, &texbufferID);
616 glBindTexture(GL_TEXTURE_2D, texbufferID); 615 glBindTexture(GL_TEXTURE_2D, texbufferID);
@@ -939,7 +938,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -939,7 +938,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
939 network_time = 0; 938 network_time = 0;
940 hit_time = 0; 939 hit_time = 0;
941 #endif 940 #endif
942 - stepsize = 2.5; 941 + stepsize = 3.0;
943 t_length = 16.0; 942 t_length = 16.0;
944 943
945 srand(100); 944 srand(100);
@@ -1387,7 +1386,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -1387,7 +1386,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
1387 void 1386 void
1388 MonteCarloDirectionVectors(int nSamples, float solidAngle = 2*M_PI) 1387 MonteCarloDirectionVectors(int nSamples, float solidAngle = 2*M_PI)
1389 { 1388 {
1390 - float PHI[2], Z[2]; 1389 + float PHI[2], Z[2], range;
1391 PHI[0] = asin(solidAngle/2); 1390 PHI[0] = asin(solidAngle/2);
1392 PHI[1] = asin(0); 1391 PHI[1] = asin(0);
1393 1392
@@ -1397,6 +1396,9 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -1397,6 +1396,9 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
1397 1396
1398 range = Z[0] - Z[1]; 1397 range = Z[0] - Z[1];
1399 1398
  1399 +
  1400 + float z, theta, phi;
  1401 +
1400 std::vector<stim::vec3<float> > vecsUni; 1402 std::vector<stim::vec3<float> > vecsUni;
1401 for(int i = 0; i < numSamplesPos; i++) 1403 for(int i = 0; i < numSamplesPos; i++)
1402 { 1404 {
@@ -1488,6 +1490,8 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -1488,6 +1490,8 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
1488 void 1490 void
1489 trace(int min_cost) 1491 trace(int min_cost)
1490 { 1492 {
  1493 + bool sEmpty = true;
  1494 + float lastmag = 16.0;;
1491 stim::vec3<float> curSeed; 1495 stim::vec3<float> curSeed;
1492 stim::vec3<float> curSeedVec; 1496 stim::vec3<float> curSeedVec;
1493 float curSeedMag; 1497 float curSeedMag;
@@ -1523,7 +1527,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -1523,7 +1527,7 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
1523 gpuStartTimer(); 1527 gpuStartTimer();
1524 #endif 1528 #endif
1525 1529
1526 -// float s = 3.0; 1530 + float s = 3.0;
1527 GLuint selectBuf[2048]; 1531 GLuint selectBuf[2048];
1528 GLint hits; 1532 GLint hits;
1529 glSelectBuffer(2048, selectBuf); 1533 glSelectBuffer(2048, selectBuf);
@@ -1537,17 +1541,17 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -1537,17 +1541,17 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
1537 CHECK_OPENGL_ERROR 1541 CHECK_OPENGL_ERROR
1538 //What would that vessel see in front of it. 1542 //What would that vessel see in front of it.
1539 camSel.setPosition(loc); 1543 camSel.setPosition(loc);
1540 - camSel.setFocalDistance(mag/stepsize);  
1541 - camSel.LookAt((loc[0]+dir[0]*mag/stepsize),  
1542 - (loc[1]+dir[1]*mag/stepsize),  
1543 - (loc[2]+dir[2]*mag/stepsize)); 1544 + camSel.setFocalDistance(mag/s);
  1545 + camSel.LookAt((loc[0]+dir[0]*mag/s),
  1546 + (loc[1]+dir[1]*mag/s),
  1547 + (loc[2]+dir[2]*mag/s));
1544 ps = camSel.getPosition(); 1548 ps = camSel.getPosition();
1545 ups = camSel.getUp(); 1549 ups = camSel.getUp();
1546 ds = camSel.getLookAt(); 1550 ds = camSel.getLookAt();
1547 glMatrixMode(GL_PROJECTION); 1551 glMatrixMode(GL_PROJECTION);
1548 glPushMatrix(); 1552 glPushMatrix();
1549 glLoadIdentity(); 1553 glLoadIdentity();
1550 - glOrtho(-mag/stepsize/2.0, mag/stepsize/2.0, -mag/stepsize/2.0, mag/stepsize/2.0, 0.0, mag/stepsize/2.0); 1554 + glOrtho(-mag/s/2.0, mag/s/2.0, -mag/s/2.0, mag/s/2.0, 0.0, mag/s/2.0);
1551 glMatrixMode(GL_MODELVIEW); 1555 glMatrixMode(GL_MODELVIEW);
1552 glPushMatrix(); 1556 glPushMatrix();
1553 glLoadIdentity(); 1557 glLoadIdentity();
@@ -1593,11 +1597,21 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -1593,11 +1597,21 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
1593 int 1597 int
1594 processHits(GLint hits, GLuint buffer[]) 1598 processHits(GLint hits, GLuint buffer[])
1595 { 1599 {
1596 - GLuint *ptr; 1600 + GLuint names, *ptr;
  1601 + //printf("hits = %u\n", hits);
1597 ptr = (GLuint *) buffer; 1602 ptr = (GLuint *) buffer;
  1603 + // for (int i = 0; i < hits; i++) { /* for each hit */
  1604 + names = *ptr;
  1605 + // printf (" number of names for hit = %u\n", names);
1598 ptr++; 1606 ptr++;
1599 ptr++; //Skip the minimum depth value. 1607 ptr++; //Skip the minimum depth value.
1600 ptr++; //Skip the maximum depth value. 1608 ptr++; //Skip the maximum depth value.
  1609 + // printf (" the name is ");
  1610 + // for (int j = 0; j < names; j++) { /* for each name */
  1611 + // printf ("%u ", *ptr); ptr++;
  1612 + // }
  1613 + // printf ("\n");
  1614 + // }
1601 1615
1602 1616
1603 if(hits == 0) 1617 if(hits == 0)
@@ -1661,18 +1675,11 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -1661,18 +1675,11 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
1661 } 1675 }
1662 1676
1663 #ifdef TIMING 1677 #ifdef TIMING
1664 - double nt = (std::clock() - s) / (double) CLOCKS_PER_SEC;  
1665 - network_time += nt * 1000.0; 1678 + double network_time = (std::clock() - s) / (double) CLOCKS_PER_SEC;
  1679 + network_time += network_time * 1000.0;
1666 #endif 1680 #endif
1667 } 1681 }
1668 1682
1669 -// void  
1670 -// addToNetwork(pair<stim::fiber<float>, int> in, stim::vec3<float> spos,  
1671 -// stim::vec<float> smag, stim::vec3<float> sdir)  
1672 -// {  
1673 -//  
1674 -// }  
1675 -  
1676 1683
1677 void 1684 void
1678 printSizes() 1685 printSizes()
@@ -1776,6 +1783,9 @@ class gl_spider : public virtual gl_texture&lt;T&gt; @@ -1776,6 +1783,9 @@ class gl_spider : public virtual gl_texture&lt;T&gt;
1776 } 1783 }
1777 } 1784 }
1778 } 1785 }
  1786 +
  1787 +
  1788 +
1779 }; 1789 };
1780 } 1790 }
1781 #endif 1791 #endif
stim/math/matrix.h
@@ -53,13 +53,13 @@ struct matrix @@ -53,13 +53,13 @@ struct matrix
53 53
54 template<typename Y> 54 template<typename Y>
55 vec<Y> operator*(vec<Y> rhs){ 55 vec<Y> operator*(vec<Y> rhs){
56 - unsigned int M = rhs.size(); 56 + unsigned int N = rhs.size();
57 57
58 vec<Y> result; 58 vec<Y> result;
59 - result.resize(M); 59 + result.resize(N);
60 60
61 - for(int r=0; r<M; r++)  
62 - for(int c=0; c<M; c++) 61 + for(int r=0; r<N; r++)
  62 + for(int c=0; c<N; c++)
63 result[r] += (*this)(r, c) * rhs[c]; 63 result[r] += (*this)(r, c) * rhs[c];
64 64
65 return result; 65 return result;