64-bit integer PETSc build in Dolfin-x

While multiplying two matrices with petsc4py. I got an error saying- you must ./configure PETSc with --with-64-bit-indices for the case you are running.

How can I use 64-bit integer PETSc build in Dolfin-x.

You need to

  1. install petsc with 64 bit integers, as done in: dolfinx/Dockerfile at main · FEniCS/dolfinx · GitHub
  2. set PETSC_ARCH=linux-gnu-real-64
  3. reinstall petsc4py
  4. reinstall DOLFINx (both C++ and Python layer)
1 Like

For step 1, where I have to install petsc as done in: dolfinx/Dockerfile at main · FEniCS/dolfinx · GitHub,
Also I have to use petsc with complex build of Dolfn-x.
Do I need to uninstall Dolfin-x first.

You can simply re-install DOLFINx (if you are building to the same directory as you first installed it).

See: https://github.com/FEniCS/dolfinx/blob/main/docker/Dockerfile#L311-L329

Last time I installed Dolfin-x using docker pull dolfinx/dolfinx:latest. Uninstalling Dolfin-x docker image and pulling again will work or do I need to do something else.

When you use docker, you get a container that contains all PETSc builds (real-32/64 and complex 32/64).
You can find this in $PETSC_DIR, which in the dolfinx/dolfinx image is at /usr/local/petsc.
If you set $PETSC_ARCH to linux-gnu-complex-64,
You can follow the following instructions, after starting the dolfinx/dolfinx container:

docker run -ti -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/root/shared -w /root/shared --rm dolfinx/dolfinx
cd /root
source dolfinx-complex-mode
rm -rf /usr/local/dolfinx-complex
export PETSC_ARCH=linux-gnu-complex-64
pip3 uninstall petsc4py slepc4py
pip3 install petsc4py
pip3 install slepc4py

git clone https://github.com/FEniCS/dolfinx.git
cmake -G Ninja -B build-dir-complex -DCMAKE_INSTALL_PREFIX=/usr/local/dolfinx-complex -S ./dolfinx/cpp/
cmake --build build-dir-complex --parallel 3
cmake --install build-dir-complex
pip3 install ./dolfinx/python/ --upgrade

I am unable to find petsc folder/file in C drive. Where to check for this.
Also, Can you please tell which path to write here.

The petsc installations are found inside the dolfinx container, not in your local file path

Sir, Do I need to run the following command in docker exec command prompt of dolfinx?

Also, do we need to change the pwd in this command?

Running the same command in docker exec command prompt of dolfinx is giving the following error: /bin/sh: 1: docker: not found

If you have spawned a docker container based on dolfinx/dolfinx, you do not need to run

docker run -ti -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/root/shared -w /root/shared --rm dolfinx/dolfinx

This command is to start a docker container from command line on linux, sharing the current directory with the docker container at the path /root/shared.

Running following command

cd /root
source dolfinx-complex-mode

gives error source not found


Am I doing anything wrong

As you haven’t supplied me with how you started docker i cant really give you any more help

I am attaching all the steps that I did from the start.

  1. First I opened Docker Desktop through start menu.
    1

  2. I clicked on images in Docker Desktop application. Clicked on run button on the right of dolfinx/dolfinx image

  3. in New container window, I left all the spaces blank and clicked on run button.

  4. dolfinx/dolfinx started running. I clicked on CLI button

  5. A new window docker exec opened.

  6. I wrote the command

cd /root
source dolfinx-complex-mode

and entered, it is giving an error- source not found


These are the steps that I followed. Kindly let me know if any other information is required.

You need to actually call docker run as shown in:

You shoul add the option —name, as described in docker run | Docker Documentation in favor of —rm so that you can reuse the container.
You should also use -v as described here: docker run | Docker Documentation
Combining these, you end up with:

docker  run  -v `pwd`:`/root/shared` -w `/root/shared` -i -t  —name=dolfinx_container dolfinx/dolfinx
1 Like