Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
preprocessor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Normann Rion
preprocessor
Commits
4807a6c8
Verified
Commit
4807a6c8
authored
Nov 14, 2022
by
Sébastien Villemot
Browse files
Options
Downloads
Patches
Plain Diff
use_dll: fix race condition with compilation of power_deriv.{c,h}
parent
23b0c12d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ModelTree.hh
+10
-5
10 additions, 5 deletions
src/ModelTree.hh
with
10 additions
and
5 deletions
src/ModelTree.hh
+
10
−
5
View file @
4807a6c8
...
...
@@ -2646,16 +2646,21 @@ ModelTree::writeSparseModelCFiles(const string &basename, const string &mexext,
}
};
open_file(model_src_dir / "
power_deriv
.
h
");
/* Write source files for the derivative of the power function.
NB: The prefix (static/dynamic) is added to the filename (even though it’s
the same source between static and dynamic) to avoid a race condition when
static and dynamic are compiled in parallel. */
open_file(model_src_dir / (prefix + "
power_deriv
.
h
"));
writePowerDerivHeader(output);
output.close();
filesystem::path power_deriv_src {model_src_dir / "
power_deriv
.
c
"};
filesystem::path power_deriv_src {model_src_dir /
(prefix +
"
power_deriv
.
c
"
)
};
open_file(power_deriv_src);
output << "
#
include
<
math
.
h
>
" << endl << endl;
writePowerDeriv(output);
output.close();
auto power_deriv_object {compileMEX(model_src_dir, "
power_deriv
", mexext, { power_deriv_src },
auto power_deriv_object {compileMEX(model_src_dir, (prefix + "
power_deriv
"),
mexext, { power_deriv_src },
matlabroot, dynareroot, false)};
size_t ttlen {0};
...
...
@@ -2724,7 +2729,7 @@ ModelTree::writeSparseModelCFiles(const string &basename, const string &mexext,
open_file
(
source_tt
);
output
<<
"#include <math.h>"
<<
endl
<<
R"(#include "mex.h")"
<<
endl
// Needed for calls to external functions
<<
R"(#include "power_deriv.h")"
<<
endl
<<
R"(#include "
)"
<<
prefix
<<
R"(
power_deriv.h")"
<<
endl
<<
endl
<<
prototype_tt
<<
endl
<<
"{"
<<
endl
...
...
@@ -2866,7 +2871,7 @@ ModelTree::writeSparseModelCFiles(const string &basename, const string &mexext,
open_file
(
source_mex
);
output
<<
"#include <math.h>"
<<
endl
<<
R"(#include "mex.h")"
<<
endl
<<
R"(#include "../power_deriv.h")"
<<
endl
<<
R"(#include "../
)"
<<
prefix
<<
R"(
power_deriv.h")"
<<
endl
<<
endl
<<
"void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])"
<<
endl
<<
"{"
<<
endl
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment