jzbontar / mc-cnn

Stereo Matching by Training a Convolutional Neural Network to Compare Image Patches
BSD 2-Clause "Simplified" License
707 stars 232 forks source link

Compiling on Jetson TX1 #2

Open nznobody opened 8 years ago

nznobody commented 8 years ago

Hello,

unsure as to the causee (who is the culprit) of this issue but when making on NVidia Jetson TX1 I get the following error:

ubuntu@tegra-ubuntu:/var/git/mc-cnn$ make
nvcc -arch sm_35 -O3 -DNDEBUG --compiler-options '-fPIC' -o libadcensus.so --shared adcensus.cu -I/home/ubuntu/torch/install/include/THC -I/home/ubuntu/torch/install/include/TH -I/home/ubuntu/torch/install/include -I/usr/include/lua5.2 -L/home/ubuntu/torch/install/lib -Xlinker -rpath,/home/ubuntu/torch/install/lib -lluaT -lTHC -lTH -lpng
SpatialLogSoftMax.cu(20): error: identifier "THInf" is undefined

1 error detected in the compilation of "/tmp/tmpxft_00000445_00000000-9_adcensus.cpp1.ii".
make: *** [libadcensus.so] Error 2

After many many times of checking and recompiling my Torch installation I finally caved and patched the offender as such:

diff --git a/SpatialLogSoftMax.cu b/SpatialLogSoftMax.cu
index 5ea35d8..f430cff 100644
--- a/SpatialLogSoftMax.cu
+++ b/SpatialLogSoftMax.cu
@@ -16,7 +16,7 @@ __global__ void cunn_SpatialLogSoftMax_updateOutput_kernel
   if (idx < data_size) {
     int next_idx = idx + feature_size;
     float logsum = 0.0;
-    float max = -THInf;
+    float max = -FLT_MAX;
     // max
     for(int i = idx; i < next_idx; i += spatial_size) {
       if (max < input[i]) max = input[i];

This compiles.

dharmendrach commented 8 years ago

I faced same problem. Just replaced THInf with a very big number.

nznobody commented 8 years ago

@drc10723 Yeah it works now. Did you get pre-trained nets or did you train on the Jetson? I would like to avoid training on the Jetson if there are some trained nets publicly available?