Skip to content

Commit 225d27d

Browse files
committed
Changed mex compilation options for greater optimization of execution at runtime
1 parent 5074303 commit 225d27d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

make.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
retval = input (sprintf(['Potentially compatible precompiled mex files found. ', ...
4242
'Please select an option:\n', ...
4343
' 1) Use the precompiled mex files (default).\n', ...
44-
' 2) Compile new mex files from source.\n', ...
44+
' 2) Compile new mex files from source (recommended).\n', ...
4545
'Answer (1 or 2): ']), 's');
4646
end
4747
if isempty(retval)
@@ -88,15 +88,15 @@
8888
disp ('Attempting to compile the source code...');
8989
if isoctave
9090
try
91-
mkoctfile -std=c++11 --mex --output ./inst/boot ./src/boot.cpp
91+
mkoctfile -O3 -march=native --mex --output ./inst/boot ./src/boot.cpp
9292
catch
9393
errflag = true;
9494
err = lasterror();
9595
disp (err.message);
9696
warning ('Could not compile boot.%s. Falling back to the (slower) boot.m file.', mexext)
9797
end
9898
try
99-
mkoctfile -std=c++11 --mex --output ./inst/smoothmedian ./src/smoothmedian.cpp
99+
mkoctfile -O3 -march=native --mex --output ./inst/smoothmedian ./src/smoothmedian.cpp
100100
catch
101101
errflag = true;
102102
err = lasterror();
@@ -112,15 +112,15 @@
112112
disp(err.message);
113113
end
114114
try
115-
mex CXXFLAGS="$CXXFLAGS -std=c++11" -output ./inst/boot ./src/boot.cpp
115+
mex CXXFLAGS="$CXXFLAGS -O3 -march=native" -output ./inst/boot ./src/boot.cpp
116116
catch
117117
errflag = true;
118118
err = lasterror ();
119119
disp (err.message);
120120
warning ('Could not compile boot.%s. Falling back to the (slower) boot.m file.', mexext)
121121
end
122122
try
123-
mex CXXFLAGS="$CXXFLAGS -std=c++11" -output ./inst/smoothmedian ./src/smoothmedian.cpp
123+
mex CXXFLAGS="$CXXFLAGS -O3 -march=native" -output ./inst/smoothmedian ./src/smoothmedian.cpp
124124
catch
125125
errflag = true;
126126
err = lasterror();

src/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
make:
2-
-mkoctfile -std=c++11 --mex --output ../inst/boot ./boot.cpp
3-
-mkoctfile -std=c++11 --mex --output ../inst/smoothmedian ./smoothmedian.cpp
2+
-mkoctfile -O3 -march=native --mex --output ../inst/boot ./boot.cpp
3+
-mkoctfile -O3 -march=native --mex --output ../inst/smoothmedian ./smoothmedian.cpp

0 commit comments

Comments
 (0)