|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Join Date: Feb 2019
Posts: 3
Rep Power: 8 ![]() |
Hello Foamers,
I am trying to couple OpenFOAM and PyTorch (C++ API). I am almost done except one final bit. I am using cmake to compile the libraries together. I am trying to build the laplacianFOAM with PyTorch. In the CMakeLists.txt file, I must include find_package(Torch REQUIRED) to include torch (of course!!). This works well if I do not have any IOobject in my source. I am consistently getting the following error during compilation. CMakeFiles/mylaplacianFoam.dir/laplacianFoam.C.o ![]() collect2: error: ld returned 1 exit status CMakeFiles/mylaplacianFoam.dir/build.make:97: recipe for target 'mylaplacianFoam' failed make[2]: *** [mylaplacianFoam] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/mylaplacianFoam.dir/all' failed make[1]: *** [CMakeFiles/mylaplacianFoam.dir/all] Error 2 Makefile:83: recipe for target 'all' failed More specifically, while compiling the solver, the following declaration volScalarField T ( IOobject ( "T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); gives me the said error. If I comment out the IOobject declaration, I do not face any compilation error. I also do not get any compilation error if I use wmake (without torch library, haven't tried that route yet). So, I have two questions. 1. Why is this error cropping up when I include the PyTorch libraries? 2. Is there another way in which I can read the T data without using IOobject? EDIT:: Found the cause of the problem. It seems that the flag -D_GLIBCXX_USE_CXX11_ABI needs updating from 0 to 1. However, it still does not solve the problem. It still gives compilation error. I looked up the internet and it seems that either I have to recompile my openfoam or compile mylaplacianFoam with both the flags. Anyone knows how to do either of these things? Last edited by scientium; June 15, 2019 at 02:05. Reason: Made progress on debugging |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
serg
Join Date: Dec 2015
Posts: 29
Rep Power: 11 ![]() |
Hello,
Did you find a solution? Kind regards |
|
![]() |
![]() |
![]() |
Tags |
c++, compiling, pytorch |
Thread Tools | Search this Thread |
Display Modes | |
|
|