PETSc question

21 views
Skip to first unread message

Vitor Vasconcelos

unread,
May 21, 2018, 1:36:27 PM5/21/18
to was...@seamplex.com
Fellows,

Maybe you can help me with a milonga related question:
anybody uses a repo version of PETSc to build milonga against?

I'm planning some maintenance in some computers and is desirable to have
my packages managed by the package manager (yum in my case) and
in my first test, milonga does not find it.

So, before blaming milonga for not finding it, I would like to know if somebody
did it. All my googling showed me the usual manual compilation of PETSc.

Thanks for any enlightenment.

Vitor

Alexis Weir

unread,
May 21, 2018, 1:41:39 PM5/21/18
to was...@seamplex.com
Hi, I successfully installed milonga using ubuntu 16 repo for petsc and
slepc
I did not try in centos (I did it downloading latest version of pestc
and slepc)

Vitor Vasconcelos

unread,
May 21, 2018, 1:45:03 PM5/21/18
to was...@seamplex.com
Hi Alex,

Do you mind sharing the contents of your PETSC_DIR and PETSC_ARCH variables?

Thank you very much.

Vitor
> --
> You received this message because you are subscribed to the Google Groups
> "wasora" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to wasora+un...@seamplex.com.
> To post to this group, send email to was...@seamplex.com.
> Visit this group at https://groups.google.com/a/seamplex.com/group/wasora/.
> To view this discussion on the web visit
> https://groups.google.com/a/seamplex.com/d/msgid/wasora/552a70a2-acbf-1534-e049-872ac549f011%40cab.cnea.gov.ar.
> For more options, visit https://groups.google.com/a/seamplex.com/d/optout.

Alexis Weir

unread,
May 21, 2018, 2:10:50 PM5/21/18
to was...@seamplex.com
In ubuntu they are empty
In centos they are set to my local folders

[fr@blinky ~]$ echo $PETSC_ARCH
arch-linux2-c-debug
[fr@blinky ~]$ echo $PETSC_DIR
/home/fr/petsc-3.8.3

Vitor Vasconcelos

unread,
May 21, 2018, 2:29:32 PM5/21/18
to was...@seamplex.com
Good to know. Looks like in ubuntu somehow the package manager takes
care of everything.

Thanks,

Vitor
> https://groups.google.com/a/seamplex.com/d/msgid/wasora/e12a024f-f966-6588-cdcc-c227161b8e7b%40cab.cnea.gov.ar.

Jeremy Theler

unread,
May 21, 2018, 4:00:14 PM5/21/18
to was...@seamplex.com
According to Debian's /usr/share/doc/libpetsc-real3.8-dev, of which an excerpt is transcribed below, when milonga's configure sees that PETSC_DIR is not set or empty, it sets temporally PETSC_DIR=/usr/lib/petsc and PETSC_ARCH is left empty, so the symlink managed by Debian alternatives is used. This scheme works both for both the repository and manually-installed PETScs (and SLEPcs).

I tested this scheme in Debian and Ubuntu, and it worked (as reported by Alexis). I think Ubuntu uses a similar way of managing alternatives than Debian.
I could not test it in other distributions, even though I tried through Vagrant virtual machines.

Try to see if CentOS /usr/share/doc says anything.

----->8---------->8---------->8---------->8---------->8---------->8-----

The preferred PETSc installation is located at /usr/lib/petsc. This is a symlink
to the actual installation, managed by Debian alternatives (see below). The
standard installation is located at
 /usr/lib/petscdir/<PETSC_VERSION>/<arch>
e.g.
 /usr/lib/petscdir/3.8.0/x86_64-linux-gnu

Preferred minor patch versions of each major version (e.g. 3.8)
are linked via
 /usr/lib/petscdir/3.8
(also, preferred versions of 3.8-real and 3.8-complex). These links are
controlled by alternatives.

libpetsc.so is also controlled by alternatives (libpetsc.so.3.8)


With libpetsc3.8.0-dev installed, you can build programs against it two ways:

    1. Standard build convention: use -I/usr/include/petsc for headers and
       link to optimized libraries in /usr/lib, so your resulting binaries
       will only depend on libpetsc3.8.0.
    2. PETSc build convention: adapt a makefile from one of their tests or
       tutorial directories and build with make PETSC_DIR=/usr/lib/petsc
    3. Use pkg-config (via /usr/lib/<arch>/pkgconfig/PETSC.pc).

Of these, the latter two are probably easier, as they automatically set up
all of the include paths and library linkages for PETSc and its various
dependencies.


Vitor Vasconcelos

unread,
May 21, 2018, 6:44:09 PM5/21/18
to was...@seamplex.com
I am at home, checking Fedora. And I have bad news.

The petsc development (petsc-devel) in Fedora installs the include
files in /usr/include/petsc.
It also creates a soft link from /usr/lib64/libpetsc.so to the numbered library.

It can be even worst if you install petsc-openmpi-devel, because in
this case everything is
put behind /usr/lib64/openmpi/...

Absolutely no information in /usr/share/doc. Even if you try to
install petsc-doc package, you get only
a replicated version of PETSc website documentation.

It seems Fedora is behind Debian in this subject.

And slepc is not even provided by fedora repos.

This problem can be solved by including this information in milonga
install scripts, but
I'm not voluntering for it right now because I simply hate m4 macros,
autoconf and the related
fellows... Maybe one day. :-)

Tomorrow I'll check CentOS, but I'm almost sure the problems are the
same. For now, I'll stuck
to the compiled versions of PETSc and Slepc.


Vitor
> https://groups.google.com/a/seamplex.com/d/msgid/wasora/315c0fce5ed32a1e5f9ea3dc6275f29c86f22179.camel%40seamplex.com.

Jeremy Theler

unread,
May 22, 2018, 5:17:02 AM5/22/18
to was...@seamplex.com

On Mon, 2018-05-21 at 19:43 -0300, Vitor Vasconcelos wrote:
I am at home, checking Fedora. And I have bad news.

The petsc development (petsc-devel) in Fedora installs the include
files in /usr/include/petsc.
It also creates a soft link from /usr/lib64/libpetsc.so to the numbered library.

so adding -I/usr/include/petsc and -lpetsc should do (if /usr/lib64 is in ld's cache)


It can be even worst if you install petsc-openmpi-devel, because in
this case everything is
put behind /usr/lib64/openmpi/...


No problem if /usr/lib64/openmpi is is ld's path. What does

# ldconfig -v 2>/dev/null | grep -v ^$'\t'

say? (as root)


Absolutely no information in /usr/share/doc. Even if you try to
install petsc-doc package, you get only
a replicated version of PETSc website documentation.

It seems Fedora is behind Debian in this subject.

And slepc is not even provided by fedora repos.

so all this extra work for almost nothing


This problem can be solved by including this information in milonga
install scripts, but
I'm not voluntering for it right now because I simply hate m4 macros,
autoconf and the related
fellows... Maybe one day. :-)

M4 is great! autoconf not so much...

Tomorrow I'll check CentOS, but I'm almost sure the problems are the
same. For now, I'll stuck
to the compiled versions of PETSc and Slepc.

Let us know. If we get a workwaround I can add it to the configure script.

--
jeremy

Vitor Vasconcelos

unread,
May 22, 2018, 10:31:21 AM5/22/18
to was...@seamplex.com
> so adding -I/usr/include/petsc and -lpetsc should do (if /usr/lib64 is in
> ld's cache)

Yes, it will work (this is the CentOS machine)

[root@caprara-lx milonga]# /sbin/ldconfig -p | grep petsc
libpetsc.so.3.8 (libc6,x86-64) => /lib64/libpetsc.so.3.8
libpetsc.so (libc6,x86-64) => /lib64/libpetsc.so

> No problem if /usr/lib64/openmpi is is ld's path. What does
>
> # ldconfig -v 2>/dev/null | grep -v ^$'\t'
>
> say? (as root)

root@caprara-lx milonga]# ldconfig -v 2>/dev/null | grep -v ^$'\t'
/opt/amdgpu-pro/lib64:
/opt/amdgpu/lib64:
/usr/lib64/atlas:
/usr/lib64/dyninst:
/usr/lib64/iscsi:
/usr/lib64/mysql:
/lib:
/lib64:
/lib/sse2: (hwcap: 0x0000000004000000)
/lib/i686: (hwcap: 0x0008000000000000)
/lib64/sse2: (hwcap: 0x0000000004000000)
/lib64/tls: (hwcap: 0x8000000000000000)

So, looks like the openmpi version distributed by CentOS does not
like add its directory to LD path. Anyway, I could not even get the
documentation
explaining the differences between petsc-devel and petsc-openmpi-devel*.

*It can be guessed by the names, but I would like to have a formal explanation
on how both packages are built. Documentation is always nice.

> And slepc is not even provided by fedora repos.
>
>
> so all this extra work for almost nothing

I am with you: if I have to bother manually installing SLEPc, I can
do it for PETSc too. Debian wins here.

> M4 is great! autoconf not so much...

I know you're a fan of the beast. Indeed, if you have patience to learn it,
it can be an amazing tool. :-)

Thanks everybody for the replies.

Vitor

jeremy theler

unread,
May 22, 2018, 3:43:15 PM5/22/18
to was...@seamplex.com
I would write a script (ran as root) that installs all needed dependencies for both PETSc and SLEPc, download and uncompress the tarballs in /usr/lib/petsc and /usr/lib/slepc and compiles them. This way probable milonga might find them with the default PETSC_DIR value.
I think that if PETSC_ARCH is not set PETSc chooses a default, probably it should be emptied. At the worst-case scenario, a symlink in /usr/lib/petsc might solve it.

Do you also dislike Bash?

--
You received this message because you are subscribed to the Google Groups "wasora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wasora+un...@seamplex.com.
To post to this group, send email to was...@seamplex.com.
Visit this group at https://groups.google.com/a/seamplex.com/group/wasora/.
--
--
jeremy theler
www.seamplex.com

Vitor Vasconcelos

unread,
May 22, 2018, 4:18:21 PM5/22/18
to was...@seamplex.com
> I would write a script (ran as root) that installs all needed dependencies
> for both PETSc and SLEPc, download and uncompress the tarballs in
> /usr/lib/petsc and /usr/lib/slepc and compiles them. This way probable
> milonga might find them with the default PETSC_DIR value.
> I think that if PETSC_ARCH is not set PETSc chooses a default, probably it
> should be emptied. At the worst-case scenario, a symlink in /usr/lib/petsc
> might solve it.
>
> Do you also dislike Bash?

Ahahaha, no. I like it very much, actually :-)
And your idea is pretty much what I have in mind: a neat and
simple solution
to have both libraries installed and up-to-date.

Vitor
Reply all
Reply to author
Forward
0 new messages