Eigen version for Cantera 2.6.0

140 views
Skip to first unread message

Jacob

unread,
Sep 1, 2023, 12:05:44 AM9/1/23
to Cantera Users' Group
How can I figure out which version of Eigen does Cantera 2.6.0 use? I am trying to compile Cantera 2.6.0 source (which I edited slightly) with Tensorflow 2.13.0 which uses Eigen 3.4.9. 

I can compile them separately and get no errors, however when I compile them together (I added some Tensorflow code into Cantera source) I get errors similar to the  following:

from /home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include/tensorflow/core/platform/bfloat16.h:21,
from /home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include/tensorflow/core/platform/types.h:19,
from /home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include/tensorflow/core/platform/logging.h:19,
from /home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include/tensorflow/core/platform/status.h:19,
from /home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include/tensorflow/core/lib/core/status.h:19,
from /home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include/tensorflow/cc/saved_model/loader.h:25,
from include/cantera/oneD/StFlow.h:18,
from include/cantera/oneD/Boundary1D.h:16,
from src/oneD/Boundary1D.cpp:6:
/home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include/tensorflow/tsl/platform/bfloat16.h:24:16: error: 'bfloat16' in namespace 'Eigen' does not name a type
24 | typedef Eigen::bfloat16 bfloat16;

Ray Speth

unread,
Sep 1, 2023, 8:19:46 AM9/1/23
to Cantera Users' Group

Hi Jacob,

Cantera 2.6.0 should work with a range of Eigen versions. If you don’t specify a location and SCons can’t find a version installed in a standard location, it will use a Git submodule, which is set to provide Eigen 3.3.7. To ensure consistency, you should explicitly set the SCons option system_eigen=y and add the directory containing the Eigen headers used by Tensorflow to the extra_inc_dirs option. I assume you meant either version 3.3.9 or 3.4.0, since 3.4.0 is the most recent Eigen release.

Regards,
Ray

Jacob

unread,
Sep 2, 2023, 3:19:25 AM9/2/23
to Cantera Users' Group
Hello,

Firstly, thank you for your reply! When I run SCons build with the settings you described, I can see that it points to the correct Eigen installation which uses version 3.4.90 according to the output log (also the documentation is titled as 3.4.90 https://eigen.tuxfamily.org/dox/). However I keep getting errors related to the Eigen installation. I attached the output.log, but if you think that this is not a cantera related issue then I would not want to take anymore of your time.

Sincerely,
Jacob
output.log

Ray Speth

unread,
Sep 2, 2023, 11:09:22 AM9/2/23
to Cantera Users' Group

Hi Jacob,

That appears to possibly be the latest development / unstable version of Eigen. As it says on the Eigen homepage (https://eigen.tuxfamily.org/index.php?title=Main_Page), the latest stable release is Eigen 3.4.0. Cantera has been tested to work with this version, but not with any development versions beyond that.

I noticed two things from the log:

First, there are some warnings that reference include/cantera/ext/Eigen, which suggest that you had previously compiled Cantera with the Eigen headers provided by Cantera. I would recommend deleting the directory include/cantera/ext/Eigen so these headers don’t get picked up before the ones from the Tensorflow installation.

Second, the directory you’re specifying as extra_inc_dirs is not the same as the directory where the build is picking up the Eigen headers, and I’m not sure what’s happening to get both of these directories on the compiler’s path. The former is

/home/mert/anaconda3/envs/tf/lib/python3.9/site-packages/tensorflow/include/third_party/

while the latter is:

/home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include/third_party

If these aren’t exactly the same version of Tensorflow and/or Eigen, then the compiler errors are not surprising.

Regards,
Ray

Jacob

unread,
Sep 3, 2023, 11:26:14 PM9/3/23
to Cantera Users' Group
Hello,

Once again, thank you for your reply. I have removed `include/cantera/ext/Eigen` and also removed the line I added previously `env.Append(CPPPATH=['/home/mert/anaconda3/envs/tf/lib/python3.9/site-packages/tensorflow/include'])` from the SConstruct file. I also changed the directory in `extra_inc_dirs` to  `/home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include/third_party`.

I no longer get an error related to eigen however now I get an error related to protoc. The version I used to compile the headers in the directory I specified was 3.21.9, and this version is installed in my `/home/mert/anaconda3/envs/tf/lib/python3.9/site-packages/tensorflow/include` directory. How can edit the SConstruct file of Cantera so that it uses the the headers that I desire? I attached the log file like previously.

Sincerely,
Jacob

output.log

Jacob

unread,
Sep 4, 2023, 2:31:59 AM9/4/23
to Cantera Users' Group
To clarify, I am talking about Protocol Buffers version 3.21.9. As far as I understand SConstruct file by default uses the Protobuff version located in the default user library, but I am not sure.

Ray Speth

unread,
Sep 5, 2023, 10:14:16 PM9/5/23
to Cantera Users' Group

Hi Jacob,

SCons is just managing the compiler’s search path in a pretty standard way, that is, in addition to the compiler’s default search path adding a couple of directories withing the source tree, plus any directories that you’ve specified are needed. I don’t know where else on your system you have another, conflicting copy of the Protocol Buffers headers installed.

One step you can take that might help identify where the problematic headers are installed would be to run just the failing compilation command with the addition of the -H option, which will display (to stderr) the path to every header file read (recursively) as part of that compilation. This produces a lot of output, so I would recommend running it as:

g++ -H -o build/src/oneD/Boundary1D.os -c -std=c++17 -pthread -O3 -Wno-inline -g -Wall -include src/pch/system.h -fPIC -DNDEBUG -Iinclude -Iinclude/cantera/ext -Ibuild/src -I/home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include/third_party -I/home/mert/Documents/tensorflow-2.13.0/bazel-bin/tensorflow/include src/oneD/Boundary1D.cpp 2>&1 | less

Regards,
Ray

Jacob

unread,
Sep 6, 2023, 5:40:08 AM9/6/23
to Cantera Users' Group
Hi Rey,

Thank you very much! I saw that the wrong version of Protobuf was installed in a directory that I thought had the correct version. I managed to compile Cantera and run my code with it! It was my first time doing such a thing, and I was confused but thanks to your help now I understand the whole process better.

Sincerely,
Jacob

Reply all
Reply to author
Forward
0 new messages