Permalink
Browse files

linux compat fixes

  • Loading branch information...
1 parent 89e6e9d commit bbb7b531966662c0e0cb64b6e311f728b4ec0f17 @rbgirshick rbgirshick committed Aug 9, 2015
Showing with 26 additions and 20 deletions.
  1. +1 −0 faster_rcnn_build.m
  2. +1 −1 functions/nms/nms_gpu_mex.cu
  3. +6 −4 functions/nms/nms_mex.cpp
  4. +7 −9 functions/nms/nvmex.m
  5. +11 −6 startup.m
View
@@ -11,6 +11,7 @@ function faster_rcnn_build()
fprintf('Compiling nms_mex\n');
mex -O -outdir bin ...
+ CXXFLAGS="\$CXXFLAGS -std=c++11" ...
-largeArrayDims ...
functions/nms/nms_mex.cpp ...
-output nms_mex;
@@ -69,7 +69,7 @@ __global__ void nms_kernel(const int n_boxes, const float nms_overlap_thres, con
* Host code
*/
void mexFunction(int nlhs, mxArray *plhs[],
- int nrhs, mxArray const *prhs[])
+ int nrhs, const mxArray *prhs[])
{
/* Declare all variables.*/
@@ -1,6 +1,8 @@
#include "mex.h"
+#ifdef _MSC_VER
#include <windows.h>
#include <tchar.h>
+#endif
#include <vector>
#include <map>
using namespace std;
@@ -40,15 +42,15 @@ void nms(const mxArray *input_boxes, double overlap, vector<int> &vPick, int &nP
vPick[nPick] = last;
nPick += 1;
- for (std::multimap<T, int>::iterator it = scores.begin(); it != scores.end();)
+ for (typename std::multimap<T, int>::iterator it = scores.begin(); it != scores.end();)
{
int it_idx = it->second;
T xx1 = max(pBoxes[0*nSample + last], pBoxes[0*nSample + it_idx]);
T yy1 = max(pBoxes[1*nSample + last], pBoxes[1*nSample + it_idx]);
T xx2 = min(pBoxes[2*nSample + last], pBoxes[2*nSample + it_idx]);
T yy2 = min(pBoxes[3*nSample + last], pBoxes[3*nSample + it_idx]);
- double w = max(0.0, xx2-xx1+1), h = max(0.0, yy2-yy1+1);
+ double w = max(T(0.0), xx2-xx1+1), h = max(T(0.0), yy2-yy1+1);
double ov = w*h / (vArea[last] + vArea[it_idx] - w*h);
@@ -66,7 +68,7 @@ void nms(const mxArray *input_boxes, double overlap, vector<int> &vPick, int &nP
}
-void mexFunction(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
if (nrhs != 2)
mexErrMsgTxt("Wrong number of inputs");
@@ -107,4 +109,4 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
double *pRst = mxGetPr(plhs[0]);
for (int i = 0; i < nPick; ++i)
pRst[i] = vPick[i] + 1;
-}
+}
View
@@ -16,22 +16,20 @@ function nvmex(cuFileName, outDir)
machine_str = ' --machine 64 ';
CUDA_LIB_Location = ['"' getenv('CUDA_PATH') '\lib\x64"'];
end
+ NVCC = 'nvcc';
else % Mac and Linux (assuming gcc is on the path)
CUDA_INC_Location = '/usr/local/cuda/include';
CUDA_SAMPLES_Location = '/usr/local/cuda/samples/common/inc';
- Host_Compiler_Location = ' ';
- PIC_Option = ' --compiler-options -fPIC ';
+ Host_Compiler_Location = ' ';
+ PIC_Option = ' --compiler-options -fPIC ';
machine_str = [];
- if ( strcmp(computer('arch'),'win32') ==1)
- CUDA_LIB_Location = '/usr/local/cuda/lib';
- elseif ( strcmp(computer('arch'),'win64') ==1)
- CUDA_LIB_Location = '/usr/local/cuda/lib64';
- end
+ CUDA_LIB_Location = '/usr/local/cuda/lib64';
+ NVCC = '/usr/local/cuda/bin/nvcc';
end
% !!! End of things to modify !!!
[~, filename] = fileparts(cuFileName);
nvccCommandLine = [ ...
-'nvcc --compile ' Host_Compiler_Location ' ' ...
+NVCC ' --compile ' Host_Compiler_Location ' ' ...
'-o ' filename '.o ' ...
machine_str PIC_Option ...
' -I' '"' matlabroot '/extern/include "' ...
@@ -48,4 +46,4 @@ function nvmex(cuFileName, outDir)
end
disp(mexCommandLine);
eval(mexCommandLine);
-end
+end
View
@@ -12,16 +12,21 @@ function startup()
addpath(genpath(fullfile(curdir, 'bin')));
addpath(genpath(fullfile(curdir, 'experiments')));
addpath(genpath(fullfile(curdir, 'imdb')));
-
+
mkdir_if_missing(fullfile(curdir, 'datasets'));
-
+
mkdir_if_missing(fullfile(curdir, 'external'));
- addpath(genpath(fullfile(curdir, 'external')));
-
+
+ caffe_path = fullfile(curdir, 'external', 'caffe', 'matlab');
+ if exist(caffe_path, 'dir') == 0
+ error('matcaffe is missing from external/caffe/matlab; See README.md');
+ end
+ addpath(genpath(caffe_path));
+
mkdir_if_missing(fullfile(curdir, 'imdb', 'cache'));
-
+
mkdir_if_missing(fullfile(curdir, 'output'));
-
+
mkdir_if_missing(fullfile(curdir, 'models'));
fprintf('fast_rcnn startup done\n');

0 comments on commit bbb7b53

Please sign in to comment.