Commit 9474c2835439c325ea2025a94879f7b311830f61
1 parent
7ada0a48
removed some unused variables that cause the generation of warnings
Showing
5 changed files
with
41 additions
and
51 deletions
Show diff stats
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,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
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> | ||
10 | #include <stim/cuda/cudatools/devices.h> | 11 | #include <stim/cuda/cudatools/devices.h> |
11 | #include <stim/cuda/cudatools/threads.h> | 12 | #include <stim/cuda/cudatools/threads.h> |
12 | #include <stim/cuda/cuda_texture.cuh> | 13 | #include <stim/cuda/cuda_texture.cuh> |
@@ -14,7 +15,6 @@ | @@ -14,7 +15,6 @@ | ||
14 | #include <stim/cuda/arraymath.cuh> | 15 | #include <stim/cuda/arraymath.cuh> |
15 | 16 | ||
16 | #define IMAD(a,b,c) ( __mul24((a), (b)) + (c) ) | 17 | #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/M_PI/powf(sigma, 4))* (1 - (powf(x,2)+powf(y,2))/2.0/powf(sigma, 2)) | 76 | + LoG[idx] = (-1.0/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 | ||
101 | \ No newline at end of file | 100 | \ No newline at end of file |
101 | +#endif |
stim/gl/gl_spider.h
@@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
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> | ||
17 | #include <stim/cuda/spider_cost.cuh> | 18 | #include <stim/cuda/spider_cost.cuh> |
18 | #include <stim/cuda/cudatools/glbind.h> | 19 | #include <stim/cuda/cudatools/glbind.h> |
19 | #include <stim/cuda/arraymath.cuh> | 20 | #include <stim/cuda/arraymath.cuh> |
@@ -369,7 +370,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -369,7 +370,7 @@ class gl_spider : public virtual gl_texture<T> | ||
369 | ///Stored in a display list. | 370 | ///Stored in a display list. |
370 | ///uses the default d vector <0,0,1> | 371 | ///uses the default d vector <0,0,1> |
371 | void | 372 | void |
372 | - genDirectionVectors(float solidAngle = 5/M_PI*4) | 373 | + genDirectionVectors(float solidAngle = M_PI/2) |
373 | { | 374 | { |
374 | 375 | ||
375 | //Set up the vectors necessary for Rectangle creation. | 376 | //Set up the vectors necessary for Rectangle creation. |
@@ -584,7 +585,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -584,7 +585,7 @@ class gl_spider : public virtual gl_texture<T> | ||
584 | glDeleteFramebuffers(1, &framebufferID); | 585 | glDeleteFramebuffers(1, &framebufferID); |
585 | glGenFramebuffers(1, &framebufferID); | 586 | glGenFramebuffers(1, &framebufferID); |
586 | glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); | 587 | glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); |
587 | - int numChannels = 1; | 588 | +// int numChannels = 1; |
588 | // unsigned char* texels = new unsigned char[width * height * numChannels]; | 589 | // unsigned char* texels = new unsigned char[width * height * numChannels]; |
589 | glGenTextures(1, &textureID); | 590 | glGenTextures(1, &textureID); |
590 | glBindTexture(GL_TEXTURE_2D, textureID); | 591 | glBindTexture(GL_TEXTURE_2D, textureID); |
@@ -609,7 +610,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -609,7 +610,7 @@ class gl_spider : public virtual gl_texture<T> | ||
609 | { | 610 | { |
610 | glGenFramebuffers(1, &fboID); | 611 | glGenFramebuffers(1, &fboID); |
611 | glBindFramebuffer(GL_FRAMEBUFFER, fboID); | 612 | glBindFramebuffer(GL_FRAMEBUFFER, fboID); |
612 | - int numChannels = 1; | 613 | +// int numChannels = 1; |
613 | // unsigned char* texels = new unsigned char[width * height * numChannels]; | 614 | // unsigned char* texels = new unsigned char[width * height * numChannels]; |
614 | glGenTextures(1, &texbufferID); | 615 | glGenTextures(1, &texbufferID); |
615 | glBindTexture(GL_TEXTURE_2D, texbufferID); | 616 | glBindTexture(GL_TEXTURE_2D, texbufferID); |
@@ -938,7 +939,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -938,7 +939,7 @@ class gl_spider : public virtual gl_texture<T> | ||
938 | network_time = 0; | 939 | network_time = 0; |
939 | hit_time = 0; | 940 | hit_time = 0; |
940 | #endif | 941 | #endif |
941 | - stepsize = 3.0; | 942 | + stepsize = 2.5; |
942 | t_length = 16.0; | 943 | t_length = 16.0; |
943 | 944 | ||
944 | srand(100); | 945 | srand(100); |
@@ -1386,7 +1387,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -1386,7 +1387,7 @@ class gl_spider : public virtual gl_texture<T> | ||
1386 | void | 1387 | void |
1387 | MonteCarloDirectionVectors(int nSamples, float solidAngle = 2*M_PI) | 1388 | MonteCarloDirectionVectors(int nSamples, float solidAngle = 2*M_PI) |
1388 | { | 1389 | { |
1389 | - float PHI[2], Z[2], range; | 1390 | + float PHI[2], Z[2]; |
1390 | PHI[0] = asin(solidAngle/2); | 1391 | PHI[0] = asin(solidAngle/2); |
1391 | PHI[1] = asin(0); | 1392 | PHI[1] = asin(0); |
1392 | 1393 | ||
@@ -1396,9 +1397,6 @@ class gl_spider : public virtual gl_texture<T> | @@ -1396,9 +1397,6 @@ class gl_spider : public virtual gl_texture<T> | ||
1396 | 1397 | ||
1397 | range = Z[0] - Z[1]; | 1398 | range = Z[0] - Z[1]; |
1398 | 1399 | ||
1399 | - | ||
1400 | - float z, theta, phi; | ||
1401 | - | ||
1402 | std::vector<stim::vec3<float> > vecsUni; | 1400 | std::vector<stim::vec3<float> > vecsUni; |
1403 | for(int i = 0; i < numSamplesPos; i++) | 1401 | for(int i = 0; i < numSamplesPos; i++) |
1404 | { | 1402 | { |
@@ -1490,8 +1488,6 @@ class gl_spider : public virtual gl_texture<T> | @@ -1490,8 +1488,6 @@ class gl_spider : public virtual gl_texture<T> | ||
1490 | void | 1488 | void |
1491 | trace(int min_cost) | 1489 | trace(int min_cost) |
1492 | { | 1490 | { |
1493 | - bool sEmpty = true; | ||
1494 | - float lastmag = 16.0;; | ||
1495 | stim::vec3<float> curSeed; | 1491 | stim::vec3<float> curSeed; |
1496 | stim::vec3<float> curSeedVec; | 1492 | stim::vec3<float> curSeedVec; |
1497 | float curSeedMag; | 1493 | float curSeedMag; |
@@ -1527,7 +1523,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -1527,7 +1523,7 @@ class gl_spider : public virtual gl_texture<T> | ||
1527 | gpuStartTimer(); | 1523 | gpuStartTimer(); |
1528 | #endif | 1524 | #endif |
1529 | 1525 | ||
1530 | - float s = 3.0; | 1526 | +// float s = 3.0; |
1531 | GLuint selectBuf[2048]; | 1527 | GLuint selectBuf[2048]; |
1532 | GLint hits; | 1528 | GLint hits; |
1533 | glSelectBuffer(2048, selectBuf); | 1529 | glSelectBuffer(2048, selectBuf); |
@@ -1541,17 +1537,17 @@ class gl_spider : public virtual gl_texture<T> | @@ -1541,17 +1537,17 @@ class gl_spider : public virtual gl_texture<T> | ||
1541 | CHECK_OPENGL_ERROR | 1537 | CHECK_OPENGL_ERROR |
1542 | //What would that vessel see in front of it. | 1538 | //What would that vessel see in front of it. |
1543 | camSel.setPosition(loc); | 1539 | camSel.setPosition(loc); |
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)); | 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)); | ||
1548 | ps = camSel.getPosition(); | 1544 | ps = camSel.getPosition(); |
1549 | ups = camSel.getUp(); | 1545 | ups = camSel.getUp(); |
1550 | ds = camSel.getLookAt(); | 1546 | ds = camSel.getLookAt(); |
1551 | glMatrixMode(GL_PROJECTION); | 1547 | glMatrixMode(GL_PROJECTION); |
1552 | glPushMatrix(); | 1548 | glPushMatrix(); |
1553 | glLoadIdentity(); | 1549 | glLoadIdentity(); |
1554 | - glOrtho(-mag/s/2.0, mag/s/2.0, -mag/s/2.0, mag/s/2.0, 0.0, mag/s/2.0); | 1550 | + glOrtho(-mag/stepsize/2.0, mag/stepsize/2.0, -mag/stepsize/2.0, mag/stepsize/2.0, 0.0, mag/stepsize/2.0); |
1555 | glMatrixMode(GL_MODELVIEW); | 1551 | glMatrixMode(GL_MODELVIEW); |
1556 | glPushMatrix(); | 1552 | glPushMatrix(); |
1557 | glLoadIdentity(); | 1553 | glLoadIdentity(); |
@@ -1597,21 +1593,11 @@ class gl_spider : public virtual gl_texture<T> | @@ -1597,21 +1593,11 @@ class gl_spider : public virtual gl_texture<T> | ||
1597 | int | 1593 | int |
1598 | processHits(GLint hits, GLuint buffer[]) | 1594 | processHits(GLint hits, GLuint buffer[]) |
1599 | { | 1595 | { |
1600 | - GLuint names, *ptr; | ||
1601 | - //printf("hits = %u\n", hits); | 1596 | + GLuint *ptr; |
1602 | ptr = (GLuint *) buffer; | 1597 | 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); | ||
1606 | ptr++; | 1598 | ptr++; |
1607 | ptr++; //Skip the minimum depth value. | 1599 | ptr++; //Skip the minimum depth value. |
1608 | ptr++; //Skip the maximum depth value. | 1600 | 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 | - // } | ||
1615 | 1601 | ||
1616 | 1602 | ||
1617 | if(hits == 0) | 1603 | if(hits == 0) |
@@ -1675,11 +1661,18 @@ class gl_spider : public virtual gl_texture<T> | @@ -1675,11 +1661,18 @@ class gl_spider : public virtual gl_texture<T> | ||
1675 | } | 1661 | } |
1676 | 1662 | ||
1677 | #ifdef TIMING | 1663 | #ifdef TIMING |
1678 | - double network_time = (std::clock() - s) / (double) CLOCKS_PER_SEC; | ||
1679 | - network_time += network_time * 1000.0; | 1664 | + double nt = (std::clock() - s) / (double) CLOCKS_PER_SEC; |
1665 | + network_time += nt * 1000.0; | ||
1680 | #endif | 1666 | #endif |
1681 | } | 1667 | } |
1682 | 1668 | ||
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 | + | ||
1683 | 1676 | ||
1684 | void | 1677 | void |
1685 | printSizes() | 1678 | printSizes() |
@@ -1783,9 +1776,6 @@ class gl_spider : public virtual gl_texture<T> | @@ -1783,9 +1776,6 @@ class gl_spider : public virtual gl_texture<T> | ||
1783 | } | 1776 | } |
1784 | } | 1777 | } |
1785 | } | 1778 | } |
1786 | - | ||
1787 | - | ||
1788 | - | ||
1789 | }; | 1779 | }; |
1790 | } | 1780 | } |
1791 | #endif | 1781 | #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 N = rhs.size(); | 56 | + unsigned int M = rhs.size(); |
57 | 57 | ||
58 | vec<Y> result; | 58 | vec<Y> result; |
59 | - result.resize(N); | 59 | + result.resize(M); |
60 | 60 | ||
61 | - for(int r=0; r<N; r++) | ||
62 | - for(int c=0; c<N; c++) | 61 | + for(int r=0; r<M; r++) |
62 | + for(int c=0; c<M; 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; |
-
mentioned in commit 0730bd0415d46852d166ba3c97955996fc32b19c