Build system: change the flag used for OpenMP compilation
git-svn-id: https://www.dynare.org/svn/dynare/trunk@2950 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
ac483e3977
commit
2ac1194d39
|
@ -27,7 +27,6 @@ AC_MSG_CHECKING([for options to compile MEX for MATLAB])
|
||||||
MATLAB_CPPFLAGS="-I$MATLAB/extern/include"
|
MATLAB_CPPFLAGS="-I$MATLAB/extern/include"
|
||||||
MATLAB_CC="$CC"
|
MATLAB_CC="$CC"
|
||||||
MATLAB_CXX="$CXX"
|
MATLAB_CXX="$CXX"
|
||||||
MATLAB_DEFS="-DNO_OPENMP" # Don't use OpenMP (flag used by S. Adjemian in some DLLs)
|
|
||||||
|
|
||||||
case ${MATLAB_ARCH} in
|
case ${MATLAB_ARCH} in
|
||||||
glnx86 | glnxa64)
|
glnx86 | glnxa64)
|
||||||
|
|
|
@ -2,7 +2,7 @@ EXEEXT = .mex
|
||||||
|
|
||||||
CPPFLAGS = $(shell $(MKOCTFILE) -p CPPFLAGS)
|
CPPFLAGS = $(shell $(MKOCTFILE) -p CPPFLAGS)
|
||||||
|
|
||||||
DEFS = -DNO_BLAS_H -DNO_LAPACK_H -DOCTAVE -DNO_OPENMP
|
DEFS = -DNO_BLAS_H -DNO_LAPACK_H -DOCTAVE
|
||||||
|
|
||||||
CC = $(shell $(MKOCTFILE) -p CC)
|
CC = $(shell $(MKOCTFILE) -p CC)
|
||||||
CFLAGS = $(shell $(MKOCTFILE) -p CPICFLAG)
|
CFLAGS = $(shell $(MKOCTFILE) -p CPICFLAG)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
% Build file for Dynare MEX Librairies under Matlab
|
% Build file for Dynare MEX Librairies under Matlab
|
||||||
|
|
||||||
% Copyright (C) 2007-2008 Dynare Team
|
% Copyright (C) 2007-2009 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -89,9 +89,6 @@ else
|
||||||
end
|
end
|
||||||
disp(' ')
|
disp(' ')
|
||||||
|
|
||||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DNO_OPENMP' ]; % Single thread version. To compile multithreaded versions of the mex file
|
|
||||||
% use build_matlab_multithread.m instead.
|
|
||||||
% Read http://www.dynare.org/DynareWiki/UsingMultithreadedDlls.
|
|
||||||
% Set Optimization and Debug flags
|
% Set Optimization and Debug flags
|
||||||
CXXOPTIMFLAGS = ' CXXOPTIMFLAGS=-O3 ';
|
CXXOPTIMFLAGS = ' CXXOPTIMFLAGS=-O3 ';
|
||||||
COPTIMFLAGS = ' COPTIMFLAGS=-O3 ';
|
COPTIMFLAGS = ' COPTIMFLAGS=-O3 ';
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
% Build file for Dynare MEX Librairies under Matlab
|
% Build file for Dynare MEX Librairies under Matlab with multithreading
|
||||||
|
% Read http://www.dynare.org/DynareWiki/UsingMultithreadedDlls
|
||||||
|
|
||||||
% Copyright (C) 2007-2008 Dynare Team
|
% Copyright (C) 2007-2009 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -110,16 +111,15 @@ LDFLAGS = ' LDFLAGS="\$LDFLAGS -fopenmp" ';
|
||||||
|
|
||||||
disp('Compiling isopenmp...')
|
disp('Compiling isopenmp...')
|
||||||
try
|
try
|
||||||
eval([ 'mex ' COMPILE_OPTIONS CFLAGS CXXFLAGS LDFLAGS ' -outdir ' OUTPUT_DIR ' threads/isopenmp.cc ' ]);
|
eval([ 'mex ' COMPILE_OPTIONS ' -DUSE_OMP ' CFLAGS CXXFLAGS LDFLAGS ' -outdir ' OUTPUT_DIR ' threads/isopenmp.cc ' ]);
|
||||||
disp(' ')
|
disp(' ')
|
||||||
disp('|------------------------------------------------|')
|
disp('|------------------------------------------------|')
|
||||||
disp('| OpenMp is used (multithreaded mex files) for: |')
|
disp('| OpenMp is used (multithreaded mex files) for: |')
|
||||||
disp('| * sparse_hessian_times_B_kronecker_C.cc |')
|
disp('| * sparse_hessian_times_B_kronecker_C.cc |')
|
||||||
disp('| * A_times_B_kronecker_C.cc |')
|
disp('| * A_times_B_kronecker_C.cc |')
|
||||||
disp('| * bytecode (SparseMatrix.cc) |')
|
|
||||||
disp('|------------------------------------------------|')
|
disp('|------------------------------------------------|')
|
||||||
disp(' ')
|
disp(' ')
|
||||||
COMPILE_OPTIONS_OMP = [ COMPILE_OPTIONS CFLAGS CXXFLAGS LDFLAGS ];
|
COMPILE_OPTIONS_OMP = [ COMPILE_OPTIONS ' -DUSE_OMP ' CFLAGS CXXFLAGS LDFLAGS ];
|
||||||
catch
|
catch
|
||||||
disp(' ')
|
disp(' ')
|
||||||
disp('|------------------------------------------------|')
|
disp('|------------------------------------------------|')
|
||||||
|
@ -127,7 +127,7 @@ catch
|
||||||
disp('|------------------------------------------------|')
|
disp('|------------------------------------------------|')
|
||||||
disp(' ')
|
disp(' ')
|
||||||
CFLAGS = []; CXXFLAGS = []; LDFLAGS = [];
|
CFLAGS = []; CXXFLAGS = []; LDFLAGS = [];
|
||||||
COMPILE_OPTIONS_OMP = [ COMPILE_OPTIONS ' -DNO_OPENMP' ];
|
COMPILE_OPTIONS_OMP = COMPILE_OPTIONS;
|
||||||
end
|
end
|
||||||
|
|
||||||
COMPILE_COMMAND_OMP = [ 'mex ' COMPILE_OPTIONS_OMP ' -outdir ' OUTPUT_DIR ];
|
COMPILE_COMMAND_OMP = [ 'mex ' COMPILE_OPTIONS_OMP ' -outdir ' OUTPUT_DIR ];
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
COMPILE_OPTIONS = '-DNO_BLAS_H -DNO_LAPACK_H -DOCTAVE -DNO_OPENMP';
|
COMPILE_OPTIONS = '-DNO_BLAS_H -DNO_LAPACK_H -DOCTAVE';
|
||||||
|
|
||||||
% Comment next line to suppress compilation debugging info
|
% Comment next line to suppress compilation debugging info
|
||||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -v' ];
|
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -v' ];
|
||||||
|
|
|
@ -26,11 +26,6 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include "Mem_Mngr.hh"
|
#include "Mem_Mngr.hh"
|
||||||
/*#ifdef NO_OPENMP
|
|
||||||
// Nothing to single thread version.
|
|
||||||
#else
|
|
||||||
#include <omp.h>
|
|
||||||
#endif*/
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,9 +26,6 @@
|
||||||
#include "mex.h"
|
#include "mex.h"
|
||||||
#include "../matlab_versions_compatibility.h"
|
#include "../matlab_versions_compatibility.h"
|
||||||
|
|
||||||
#ifdef NO_OPENMP
|
|
||||||
#define USE_OMP 0
|
|
||||||
#define DEBUG_OMP 0
|
|
||||||
#ifdef NO_BLAS_H
|
#ifdef NO_BLAS_H
|
||||||
#if defined(__linux__) || defined(OCTAVE)
|
#if defined(__linux__) || defined(OCTAVE)
|
||||||
#define dgemm dgemm_
|
#define dgemm dgemm_
|
||||||
|
@ -39,9 +36,8 @@
|
||||||
#else /* NO_BLAS_H */
|
#else /* NO_BLAS_H */
|
||||||
#include "blas.h"
|
#include "blas.h"
|
||||||
#endif /* NO_BLAS_H */
|
#endif /* NO_BLAS_H */
|
||||||
#else
|
|
||||||
#define USE_OMP 1
|
#ifdef USE_OMP
|
||||||
#define DEBUG_OMP 0
|
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "mex.h"
|
#include "mex.h"
|
||||||
|
|
||||||
#ifdef NO_OPENMP
|
#ifdef USE_OMP
|
||||||
#define USE_OMP 0
|
# include <omp.h>
|
||||||
#define DEBUG_OMP 0
|
|
||||||
#else
|
|
||||||
#define USE_OMP 1
|
|
||||||
#define DEBUG_OMP 0
|
|
||||||
#include <omp.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MWTYPES_NOT_DEFINED
|
#ifdef MWTYPES_NOT_DEFINED
|
||||||
|
|
Loading…
Reference in New Issue