fatal error: precice/SolverInterface.hpp: No such file or directory #include “precice/SolverInterface.hpp”
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
So I copied precice/SolverInterface.hpp to python_future but another error occurred:
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: cannot find -lprecice
collect2: error: ld returned 1 exit status
error: command ‘g++’ failed with exit status 1
But libprecice.so can be found when I use locate command.
Could you check if you have a subdirectory called include/ in your preCICE installation?
If yes, try setting the environment variable CPATH to this directory.
If you do not have this subdirectory, could you give more information on how you installed preCICE? Did you install it from source and did you run make install?
As a side note: Do you require preCICE 1.6.1? It is quite old so maybe it would also make sense to start with a current version of preCICE.
Edit
Just as a further addtion: The setup.py of the python bindings got the options --include-dirs and --library-dirs that you can use in order to point it to the directory including the include files and the library of your preCICE installation. I am not sure when (in terms of which version of the bindings) these options where introduced, but you could also check if this works instead of setting the CPATH environment variable.
I do have the subdirectory called include/precice which contains some head files. Adding CPATH solved the problem of SOlverInterface.hpp.
Then I added -Lpath/to/lib/precice to setup.py and the problem of -lprecice was solved.
By the way, are there any changes needed to do in adapters and other input files to adapt to different versions of preCICE? I need to keep the same version and results in my laptop and the high-performance computer.
Regarding changes to the adapter I am not sure. The interface to the Python-bindings have changed a bit recently, but I think the precice_future API is the current state. The package Python module changed its name though.
With regard to the preCICE configuration files: Configuration files for preCICE 1.X.X are compatible with any 1.X.X version as far as I know. The configuration files of all preCICE 2.X.X versions are compatible with each other. Configuration files of preCICE 1.X.X are not compatible with preCICE 1.X.X, but the changes are rather small.
If you want to upgrade from preCICE 1.X.X to 2.X.X, I have written the bash script below some time ago to upgrade my configurations. Maybe this helps you, but it does not come with any guarantees.
#!/usr/bin/env bash
# GNU LGPL v3
# Copyright 2020 Alexander Jaust
# alexander.jaust@ipvs.uni-stuttgart.de
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
# This program 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
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
replace_string() {
local search="${1}"
local replace="${2}"
local filename="${3}"
sed -i "s/${search}/${replace}/g" "$filename"
}
for f in `ls *.xml`; do
echo $f
cp "$f" "${f}_bak"
# replace strings
replace_string "mapping:petrbf" "mapping:rbf" $f
replace_string "timestep-length" "time-window-size" $f
replace_string "max-timestep" "max-time-windows" $f
replace_string "post-processing" "acceleration" $f
replace_string "timesteps-reused" "time-windows-reused" $f
replace_string "reused-timesteps-at-restart" "reused-time-windows-at-restart" $f
replace_string "timestep-interval" "every-n-time-windows" $f
replace_string "on-timestep-complete-post" "on-time-window-complete-post" $f
done