Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#53348 closed enhancement (fixed)

OpenBLAS*: redo compiler variants

Reported by: michaelld (Michael Dickens) Owned by: NicosPavlov
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: OpenBlas, OpenBlas-devel

Description

Problem: the compiler variants for OpenBLAS* ports do not work as robustly as they might. For example, just because +clang is used for the C/C++ compiler should not mean that gcc5 should be require for Fortran -- that should be a variant of the user's choice with a default provided. Further, declaring each +gcc* variant independently of the others results in code bloat and is challenging to maintain. [Ideally we would find a way to use the compilers PortGroup, but I don't understand it well enough to use it.]

Solution: Move to more of what the compilers PortGroup does: a list of GCC variants, then do "for loops" to declare variants and do variant checking. Allow for +clang and +gcc* at the same time, or just +gcc*; the former uses Clang for C/C++ and GCC* for Fortran while the latter uses GCC* for the whole compiler suite. This setup makes it simple to add and remove GCC versions as they become available or obsolete.

I'm attaching a patch for this change. As I'm a co-maintainer, this ticket is mostly courtesy for MP developers and the other co-maintainer to provide feedback as to whether this is wise and/or done well.

Attachments (1)

OpenBlas-Portfile-tweak_compilers.diff (4.7 KB) - added by michaelld (Michael Dickens) 8 years ago.

Download all attachments as: .zip

Change History (12)

Changed 8 years ago by michaelld (Michael Dickens)

comment:1 Changed 8 years ago by michaelld (Michael Dickens)

There's no rush in pushing this change. If there's no objections, then I'll push it next week when I do my weekly updates (typically Tuesday or Wednesday).

comment:2 Changed 8 years ago by NicosPavlov

The changes are surely more consistent than what is provided for now, thanks for the patch. One thing that may become confusing is the default building variants are now +clang +gcc6 +lapack. While I understand the logic of it (clang as main compiler, gcc6 for fortran), this may appear as a mistake to some users.

However, I have no real solution there, as making additional variants for all possible fortran compiler would be overly complicated in terms of choices provided.

On the same note, building openblas +gcc5 still uses clang as default, and just changes the fortran compiler. All this is indicated in the variants descriptions, but as it is unusual behaviour, I would expect some confusion from users (even though it is probably the best choice in terms of binary efficiency).

comment:3 Changed 8 years ago by michaelld (Michael Dickens)

I agree that the variants are confusing; they were before too; still are. I did add in a switch such that if +clang is selected then the description of the +gcc* variants reads "Use gcc# as Fortran compiler"; if -clang is selected then the description reads "Use gcc# for the compiler suite" (where # is the GCC version selected).

Anyway, I think you are endorsing me committing this change, yes? If so, and, again, if no other MP dev objects, then I'll do it in my weekly updates next week. Thanks!

comment:4 Changed 8 years ago by NicosPavlov

Sure, it is much better with the changes, and you are right that it was also confusing before.

I was just making some wishful thinking about having something less confusing, but I have nothing better to offer, so please go ahead, at least on my part.

comment:5 Changed 8 years ago by seanfarley (Sean Farley)

A few questions: how hard would it be to use the compilers portgroup directly? Follow-up, why not rename +gcc6 to +gfortran6 to explicitly mean only the fortran compiler from gcc?

comment:6 Changed 8 years ago by michaelld (Michael Dickens)

I have no direct experience using the compilers portgroup; my experiences thus far are mostly through py*numpy, and someone else set the PG usage up so I didn't have to. If someone else wants to do the same here I'm all for it.

In my current changes, +clang +gcc# would mean "use Clang for C/C++ and gFortran# for Fortran", while -clang +gcc# would mean "use GCC# for the compiler suite".

I could move to using +clang +gfortran#, where the latter requires the former and conflicts to +gcc# ... but that seems like a lot of work for IMHO minimal less confusion. OTOH, at least each variant would be explicit and differentiated from all other variants, so maybe not as confusing? ... hmmmm ... this might be worth thinking about more.

Let's get more feedback from other MP devs, if at all possible.

comment:7 Changed 8 years ago by mf2k (Frank Schima)

Please move forward with this. I think you should use the compilers portgroup as originally planned. It is already confusing as is. I don't mind having +clang and +gcc# as variants allowed. Maybe just explain it in the notes field.

comment:8 Changed 8 years ago by michaelld (Michael Dickens)

OK. I forgot about it last week. I'll try to get to it on my weekly checkin this week.

I'm not using the compilers portgroup. I don't understand it well enough to use it. My patch here probably duplicates efforts, but I understand it and it works.

comment:9 Changed 8 years ago by michaelld (Michael Dickens)

In cf680f7f/macports-ports:

OpenBLAS[-devel]: fix +clang and +gcc* variants to not conflict; default to +clang (for C/C++) and +gcc6 (for Fortran). If -clang is selected, then the +gcc* variant is used as the compiler suite. Addresses ticket #53348 .

comment:10 Changed 8 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: newclosed

comment:11 Changed 8 years ago by mf2k (Frank Schima)

Seems to work. Thank you!

Note: See TracTickets for help on using tickets.