Add new num_procs MEX file for getting number of available processing units

parent f2b61b3e
ACLOCAL_AMFLAGS = -I ../../../m4
if DO_SOMETHING
SUBDIRS = mjdgges kronecker bytecode block_kalman_filter sobol local_state_space_iterations perfect_foresight_problem
SUBDIRS = mjdgges kronecker bytecode block_kalman_filter sobol local_state_space_iterations perfect_foresight_problem num_procs
# libdynare++ must come before gensylv, k_order_perturbation, dynare_simul_
if HAVE_MATIO
......
......@@ -165,6 +165,7 @@ AC_CONFIG_FILES([Makefile
block_kalman_filter/Makefile
sobol/Makefile
local_state_space_iterations/Makefile
perfect_foresight_problem/Makefile])
perfect_foresight_problem/Makefile
num_procs/Makefile])
AC_OUTPUT
include ../mex.am
include ../../num_procs.am
mex_PROGRAMS = num_procs
nodist_num_procs_SOURCES = num_procs.cc
BUILT_SOURCES = $(nodist_num_procs_SOURCES)
CLEANFILES = $(nodist_num_procs_SOURCES)
%.cc: $(top_srcdir)/../../sources/num_procs/%.cc
$(LN_S) -f $< $@
ACLOCAL_AMFLAGS = -I ../../../m4
if DO_SOMETHING
SUBDIRS = mjdgges kronecker bytecode block_kalman_filter sobol local_state_space_iterations perfect_foresight_problem
SUBDIRS = mjdgges kronecker bytecode block_kalman_filter sobol local_state_space_iterations perfect_foresight_problem num_procs
# libdynare++ must come before gensylv, k_order_perturbation, dynare_simul_
if HAVE_MATIO
......
......@@ -128,6 +128,7 @@ AC_CONFIG_FILES([Makefile
block_kalman_filter/Makefile
sobol/Makefile
local_state_space_iterations/Makefile
perfect_foresight_problem/Makefile])
perfect_foresight_problem/Makefile
num_procs/Makefile])
AC_OUTPUT
EXEEXT = .mex
include ../mex.am
include ../../num_procs.am
......@@ -14,7 +14,8 @@ EXTRA_DIST = \
local_state_space_iterations \
gensylv \
dynare_simul_ \
perfect_foresight_problem
perfect_foresight_problem \
num_procs
clean-local:
rm -rf `find mex/sources -name *.o`
......
/*
* Copyright © 2019 Dynare Team
*
* This file is part of Dynare.
*
* Dynare is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Dynare is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
#include <thread>
#include <dynmex.h>
void
mexFunction(int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
if (nrhs != 0 || nlhs != 1)
mexErrMsgTxt("Must have zero input argument and one output argument");
plhs[0] = mxCreateDoubleScalar(std::thread::hardware_concurrency());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment