Check failed: GetOpGradFactory()->insert({op, func}).second Duplicated gradient for MapAccumulate
Note:
I also posted this question here https://openmodelica.org/forum/default-topic/2570-linux-mint,-python-3-6-omc-server-is-down-please-start-it and I hope to reach a larger group with tensorflow experience as well.
I want to use the Tensorflow C++ API in a Modelica Model.
For this, I created a class in C++ that encapsulates the Tensorflow details.
Moreover, the same file contains 3 functions (to call the constructor, destructor and a function that uses an existing instance of my class. These functions are declared "extern" in the respective header file (only if read by a C++ compiler, I am using __cplusplus to differentiate).
I then compiled said file (the class and the 3 functions) into a .so using g++ (I did make use of -fPIC and -shared). In /usr/lib, I created a symlink to said shared object library.
(For completeness, I should mention that I had trouble with the "LibraryDirectory" and "IncludeDirectory" annotations. This is why I created symlinks to the contents of all the directories I would pass to g++/gcc using -L and -I (for my test program) right into Model/Resources/Library and Model/Resources/Include directories. As there were no more compilation errors, I thought that this was okay.)
Now the strange thing is:
I can use the 3 functions in a test program compiled with gcc. I linked it against all Tensorflow libraries (and libm, libstdc++ and my .so from above) and it just works as expected.
However, when I try to use these 3 functions in a) a Modelica Class (constructor and destructor), and b) a function using an "external" function call, it will compile fine but a runtime error occurs:
stdout | OMEditInfo |
/tmp/OpenModelica_fred/OMEdit/TestCpp -port=44382 -logFormat=xmltcp -override=startTime=0,stopTime=1,stepSize=0.002,tolerance=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=TestCpp_res.mat -w -lv=LOG_STATS
stdout | error |
2018-11-22 10:47:00.153977: F tensorflow/core/framework/function.cc:1440] Check failed: GetOpGradFactory()->insert({op, func}).second Duplicated gradient for MapAccumulate
stdout | error |
Process crashed
stdout | error |
Process crashed
Simulation process failed. Exited with code 6.
How is this possible? I am not able to do anything in my test program with the 3 functions that leads to the same error. What could the OMC-generated executable be doing with them that I am not in my test program?
c++ tensorflow modelica openmodelica
add a comment |
Note:
I also posted this question here https://openmodelica.org/forum/default-topic/2570-linux-mint,-python-3-6-omc-server-is-down-please-start-it and I hope to reach a larger group with tensorflow experience as well.
I want to use the Tensorflow C++ API in a Modelica Model.
For this, I created a class in C++ that encapsulates the Tensorflow details.
Moreover, the same file contains 3 functions (to call the constructor, destructor and a function that uses an existing instance of my class. These functions are declared "extern" in the respective header file (only if read by a C++ compiler, I am using __cplusplus to differentiate).
I then compiled said file (the class and the 3 functions) into a .so using g++ (I did make use of -fPIC and -shared). In /usr/lib, I created a symlink to said shared object library.
(For completeness, I should mention that I had trouble with the "LibraryDirectory" and "IncludeDirectory" annotations. This is why I created symlinks to the contents of all the directories I would pass to g++/gcc using -L and -I (for my test program) right into Model/Resources/Library and Model/Resources/Include directories. As there were no more compilation errors, I thought that this was okay.)
Now the strange thing is:
I can use the 3 functions in a test program compiled with gcc. I linked it against all Tensorflow libraries (and libm, libstdc++ and my .so from above) and it just works as expected.
However, when I try to use these 3 functions in a) a Modelica Class (constructor and destructor), and b) a function using an "external" function call, it will compile fine but a runtime error occurs:
stdout | OMEditInfo |
/tmp/OpenModelica_fred/OMEdit/TestCpp -port=44382 -logFormat=xmltcp -override=startTime=0,stopTime=1,stepSize=0.002,tolerance=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=TestCpp_res.mat -w -lv=LOG_STATS
stdout | error |
2018-11-22 10:47:00.153977: F tensorflow/core/framework/function.cc:1440] Check failed: GetOpGradFactory()->insert({op, func}).second Duplicated gradient for MapAccumulate
stdout | error |
Process crashed
stdout | error |
Process crashed
Simulation process failed. Exited with code 6.
How is this possible? I am not able to do anything in my test program with the 3 functions that leads to the same error. What could the OMC-generated executable be doing with them that I am not in my test program?
c++ tensorflow modelica openmodelica
add a comment |
Note:
I also posted this question here https://openmodelica.org/forum/default-topic/2570-linux-mint,-python-3-6-omc-server-is-down-please-start-it and I hope to reach a larger group with tensorflow experience as well.
I want to use the Tensorflow C++ API in a Modelica Model.
For this, I created a class in C++ that encapsulates the Tensorflow details.
Moreover, the same file contains 3 functions (to call the constructor, destructor and a function that uses an existing instance of my class. These functions are declared "extern" in the respective header file (only if read by a C++ compiler, I am using __cplusplus to differentiate).
I then compiled said file (the class and the 3 functions) into a .so using g++ (I did make use of -fPIC and -shared). In /usr/lib, I created a symlink to said shared object library.
(For completeness, I should mention that I had trouble with the "LibraryDirectory" and "IncludeDirectory" annotations. This is why I created symlinks to the contents of all the directories I would pass to g++/gcc using -L and -I (for my test program) right into Model/Resources/Library and Model/Resources/Include directories. As there were no more compilation errors, I thought that this was okay.)
Now the strange thing is:
I can use the 3 functions in a test program compiled with gcc. I linked it against all Tensorflow libraries (and libm, libstdc++ and my .so from above) and it just works as expected.
However, when I try to use these 3 functions in a) a Modelica Class (constructor and destructor), and b) a function using an "external" function call, it will compile fine but a runtime error occurs:
stdout | OMEditInfo |
/tmp/OpenModelica_fred/OMEdit/TestCpp -port=44382 -logFormat=xmltcp -override=startTime=0,stopTime=1,stepSize=0.002,tolerance=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=TestCpp_res.mat -w -lv=LOG_STATS
stdout | error |
2018-11-22 10:47:00.153977: F tensorflow/core/framework/function.cc:1440] Check failed: GetOpGradFactory()->insert({op, func}).second Duplicated gradient for MapAccumulate
stdout | error |
Process crashed
stdout | error |
Process crashed
Simulation process failed. Exited with code 6.
How is this possible? I am not able to do anything in my test program with the 3 functions that leads to the same error. What could the OMC-generated executable be doing with them that I am not in my test program?
c++ tensorflow modelica openmodelica
Note:
I also posted this question here https://openmodelica.org/forum/default-topic/2570-linux-mint,-python-3-6-omc-server-is-down-please-start-it and I hope to reach a larger group with tensorflow experience as well.
I want to use the Tensorflow C++ API in a Modelica Model.
For this, I created a class in C++ that encapsulates the Tensorflow details.
Moreover, the same file contains 3 functions (to call the constructor, destructor and a function that uses an existing instance of my class. These functions are declared "extern" in the respective header file (only if read by a C++ compiler, I am using __cplusplus to differentiate).
I then compiled said file (the class and the 3 functions) into a .so using g++ (I did make use of -fPIC and -shared). In /usr/lib, I created a symlink to said shared object library.
(For completeness, I should mention that I had trouble with the "LibraryDirectory" and "IncludeDirectory" annotations. This is why I created symlinks to the contents of all the directories I would pass to g++/gcc using -L and -I (for my test program) right into Model/Resources/Library and Model/Resources/Include directories. As there were no more compilation errors, I thought that this was okay.)
Now the strange thing is:
I can use the 3 functions in a test program compiled with gcc. I linked it against all Tensorflow libraries (and libm, libstdc++ and my .so from above) and it just works as expected.
However, when I try to use these 3 functions in a) a Modelica Class (constructor and destructor), and b) a function using an "external" function call, it will compile fine but a runtime error occurs:
stdout | OMEditInfo |
/tmp/OpenModelica_fred/OMEdit/TestCpp -port=44382 -logFormat=xmltcp -override=startTime=0,stopTime=1,stepSize=0.002,tolerance=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=TestCpp_res.mat -w -lv=LOG_STATS
stdout | error |
2018-11-22 10:47:00.153977: F tensorflow/core/framework/function.cc:1440] Check failed: GetOpGradFactory()->insert({op, func}).second Duplicated gradient for MapAccumulate
stdout | error |
Process crashed
stdout | error |
Process crashed
Simulation process failed. Exited with code 6.
How is this possible? I am not able to do anything in my test program with the 3 functions that leads to the same error. What could the OMC-generated executable be doing with them that I am not in my test program?
c++ tensorflow modelica openmodelica
c++ tensorflow modelica openmodelica
asked Nov 23 '18 at 9:07
dafreddafred
164
164
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I found a solution pointing the symlink "clang" in /usr/bin to "gcc".
For instructions, check https://openmodelica.org/forum/default-topic/2570-linux-mint,-python-3-6-omc-server-is-down-please-start-it .
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443553%2fcheck-failed-getopgradfactory-insertop-func-second-duplicated-gradient%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I found a solution pointing the symlink "clang" in /usr/bin to "gcc".
For instructions, check https://openmodelica.org/forum/default-topic/2570-linux-mint,-python-3-6-omc-server-is-down-please-start-it .
add a comment |
I found a solution pointing the symlink "clang" in /usr/bin to "gcc".
For instructions, check https://openmodelica.org/forum/default-topic/2570-linux-mint,-python-3-6-omc-server-is-down-please-start-it .
add a comment |
I found a solution pointing the symlink "clang" in /usr/bin to "gcc".
For instructions, check https://openmodelica.org/forum/default-topic/2570-linux-mint,-python-3-6-omc-server-is-down-please-start-it .
I found a solution pointing the symlink "clang" in /usr/bin to "gcc".
For instructions, check https://openmodelica.org/forum/default-topic/2570-linux-mint,-python-3-6-omc-server-is-down-please-start-it .
answered Nov 23 '18 at 10:14
dafreddafred
164
164
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443553%2fcheck-failed-getopgradfactory-insertop-func-second-duplicated-gradient%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown