trilinos / Trilinos

Primary repository for the Trilinos Project
https://trilinos.org/
Other
1.19k stars 565 forks source link

Create plan to drop Trilinos support for C++98 preventing the usage of C++11 #1390

Closed bartlettroscoe closed 6 years ago

bartlettroscoe commented 7 years ago

CC: @trilinos/framework, @trilinos/teuchos, @trilinos/thyra, @trilinos/nox, @maherou

Description:

The requirement to maintain C++98 support for older packages like Teuchos, Thyra, NOX and others that are still being developed and need much more development in the near future, is creating a major capability and productivity impediment for projects like ATDM. (For example, the refactoring of Thyra to improve the design, usage, and performance of RTOps will require C++11.) But we can't use C++11 in these packages because there are still some Trilinos customers that still require that these packages build with GCC 4.4.7 and C++11 turned off. And just the usage of auto alone will significantly improve the development and maintenance of templated code. (And then there is the performance improvements of using move constructors and assignment operators, etc.)

To address this problem we could either, for example:

1) Require all Trilinos customers to upgrade their compilers to GCC 4.9.3 or newer to allow C++11 to be used in all Trilinos packages from Teuchos on down the dependency chain.

or:

2) Create a fork of Trilinos for C++98 packages needed by these customers and then allow the main Trilinos 'develop' and 'master' branches require C++11 for all packages from Teuchos on down the dependency chain. (This would require the Trilinos development team to continue to provide patches, releases, and address other issues on this fork, so this fork could not be completely static but it should see very little development.)

But eventually every Trilinos customer will have a C++11 compiler so eventually we will be going with option-1 so going with option-2 in the short-term may not be too bad.

ibaned commented 7 years ago

Just to add an anecdote, I spent some time this week porting C++11 code back to C++98 for #1371, so for one thing that is an example of C++98 support costing us time. I'd also like to list the C++11 features that stood out the most as being missed:

  1. Extended initializer lists. I didn't think this would be number one, but in retrospect it is (it was being used heavily to concisely build complex data structures):

    void foo(std::vector<std::string> const& v);
    foo({"one", "two", "three"});
  2. Move semantics. This includes std::move, support for in std::vector::resize, and the emplace methods of std:: containers. The closest alternative in C++98 is what I'll call "swap semantics", which is less intuitive, more error prone, and has less support inside the STL itself (std::vector::resize could still be much slower than with C++11).

  3. Range-based for loops:

    std::set<std::string> myset;
    for (auto& str : myset) std::cout << str << '\n';
  4. auto declarations

  5. std::shared_ptr and std::unique_ptr for memory management.

The code in question didn't leverage templates very much, but if it did then <type_traits> such as std::is_same would be high on the list (and auto would be higher).

There is one more feature which is at the heart of this particular library, and that is std::any from C++17. Currently we have to use a custom implementation (Teuchos::any), but this is all the more reason to keep up with newer standards.

This all affects the design of the API itself, so it has long-lasting consequences.

bartlettroscoe commented 7 years ago

@hkthorn and @jwillenbring, this is the GitHub issue for considering dropping support for C++98. As described at:

if you build binaries with GCC 4.8.x on RHEL 7 you can run on RHEL 6 systems. I think that means we could build Trilinos with GCC 4.8.4 with C++11 enabled and link to an APP binary and then that team could deploy that APP binary to RHEL 6 systems. Therefore, if we make GCC 4.8.4 the minimum version for C++11 support with Trilinos (see #1363), then would that address the issues for this APP needing to run on stock RHEL 6 systems? Is this something we could at least test?

bartlettroscoe commented 7 years ago

I have change the scope of this to "Create plan" and moving "in progress" as suggested by @maherou at the SART meeting yesterday.

hkthorn commented 7 years ago

@bartlettroscoe @jwillenbring I have discussed the conditions with the Xyce team, under which we are amenable to Trilinos dropping C++98 support. Here is the list that the team has crafted:

1) Trilinos must provide one last release with C++98 support, Trilinos 12.12, before September 2017. 2) Trilinos must continue to maintain solver and tools interfaces that Xyce is reliant upon in Teuchos, Sacado, NOX/LOCA, etc. that currently have C++98 support. Xyce will augment its Jenkins testing to check that the Trilinos master branch is still compatible with the solver and tools interfaces. 3) Xyce needs to have a guaranteed date for the accessibility of C++11 compliant compilers on COE machines, particularly RHEL6 and RHEL7, that do not have C++11 compliant compilers by default. This accessibility must be available to any vanilla COE machines on Sandia's networks, as Xyce analysts are distributed throughout the lab. The accessibility could come via SEMS, COE support, a combination of the two, or something else. Either way, it must be a long-term solution, as RHEL7 (which supplies only gcc 4.8) will not reach EOL until 2024.

Ross' comment above is interesting and I will pass it on to the team.

jwillenbring commented 7 years ago

Also if we make 4.8 the minimum for now, then we only have to worry for the time being about RHEL 6 as a special case. @hkthorn how much RHEL 6 usage are you still seeing? Is there a plan to phase this out any time soon since RHEL 7 is avaialable?

hkthorn commented 7 years ago

@jwillenbring We have not even released a RHEL7 binary, we will using RHEL7 as one of our testing platforms soon on Jenkins. So, all of our RHEL users are RHEL6. In general, our users are not computer scientists, they are circuit designers and they don't really concern themselves with keeping up with their RHEL versions. Our users are distributed throughout the lab and we have no leverage for forcing them to change their computing platforms. As we see the drop off in the binary usage (we track downloads), we will deprecate RHEL6. However, using this approach, we only dropped RHEL5 support a year or so ago.

bartlettroscoe commented 7 years ago

@hkthorn,

Xyce needs to have a guaranteed date for the accessibility of C++11 compliant compilers on COE machines, particularly RHEL6 and RHEL7, that do not have C++11 compliant compilers by default. This accessibility must be available to any vanilla COE machines on Sandia's networks, as Xyce analysts are distributed throughout the lab. The accessibility could come via SEMS, COE support, a combination of the two, or something else. Either way, it must be a long-term solution, as RHEL7 (which supplies only gcc 4.8) will not reach EOL until 2024.

If the SEMS env is a viable solution for this then that is already covered with GCC 4.9.3. As long as these are standard RHEL 6 and RHEL 7 COE machines on the SON or SRN, then they should be able to mount the SEMS NFS share and get at these compilers. Does that solve the problem?

Trilinos must continue to maintain solver and tools interfaces that Xyce is reliant upon in Teuchos, Sacado, NOX/LOCA, etc. that currently have C++98 support. Xyce will augment its Jenkins testing to check that the Trilinos master branch is still compatible with the solver and tools interfaces.

I am wondering if that is really necessarily? I think it might work to build Xyce binaries on RHEL 6 or RHEL 7 using the SEMS env and then just copy those to any RHEL 6 or 7 COE machine for customers to use. And if the SEMS env is present on every connected SON and SRNL COE, that would be guaranteed to work I think. Worth considering? But I suspect that it would work even if you did not have the SEMS env on the target machines. If you copy enough shared libs or build with all static libs, then it would work.

bartlettroscoe commented 7 years ago

As was mentioned at the SART and Trilinos Leaders meetings yesterday, it would be good to ensure that the SEMS env's GCC 4.8.4 modules use the native GCC 4.8.4 compiler on COE RHEL 7 systems. And as I mentioned above, the site:

seems to suggest that binaries build with that native GCC 4.8.4 compiler on RHEL 7 will run on RHEL 6 systems. If that is true (which needs to be tried out by someone), then that should solve the problem of Xyce supporting basic COE RHEL 6 and 7 machines. The only issue is that we would have to make GCC 4.8.4 the minimum version of GCC for C++11 support in Trilinos (see #1363).

nmhamster commented 7 years ago

@bartlettroscoe - I don't think you can go from RHEL6 to RHEL7 because of lower libc versions. We have had some issues with this in the past building binaries to run across multiple test beds.

nmhamster commented 7 years ago

@bartlettroscoe - are you sure the RHEL Developer Packs for 6.X series don't have a GCC 4.8 you can install there? This would provide "supported" RedHat compilers for RHEL6 and then we also have SEMS.

bartlettroscoe commented 7 years ago

Darn, I did not read:

carefully enough. What it really says is:

"In addition, you can use Developer Toolset 2.1 (DTS) to use essentially the same gcc 4.8 to compile on RHEL 6, and deploy on either RHEL 6 or 7. Since DTS is not on RHEL 7 yet, this gives you a head start on RHEL 6 so you can code for RHEL 7 even before you have it (RHEL 7) installed or deployed on your system or in your organization."

So I had it backwards. If you have the the "Developer Toolset 2.1 (DTS)" in RHEL 6, then that gives you a GCC 4.8 compiler that you can use to create binaries built on RHEL 6 to run on RHEL 6 or RHEL 7. But it does not look like "Developer Toolset 2.1 (DTS)" is installed on the COE RHEL 6 machines by default (from looking at my RHEL 6 machine).

What about this approach:

?

jwillenbring commented 7 years ago

I spoke with @dmvigi and we have a tentative plan that sounds workable on a reasonable timeline for the Xyce team. This still needs to be communicated to the Xyce team, but there is a decent chance this may work. It involves an initial prototype deployment c++ compliant compilers for RHEL 6, and leveraging the 4.8 compilers native to RHEL 7. We can report back after that meeting.

bartlettroscoe commented 7 years ago

From Mike G.:

I know there have been a lot of discussion lately on gcc versions that can be easily installed on SNL RHEL6 COE machines. Here is the list of gcc versions associated with each version of the Red Hat Developer Toolset RPMs that are available for installation. DevTools GCC
1.0 4.7.0 1.1 4.7.2 2.0 4.8.1 2.1 4.8.2 3.0 4.9.1 3.1 4.9.2 4.0 5.2.1 4.1 5.3.1 6.0 6.2.1 6.1 6.3.1

My guess is that GCCC 4.8.2 that comes with DevTools 2.1 or GCC 4.9.2 that comes with DevTools 3.1 might be able to build Trilinos for the packagse needed by Xyce with C++11 enabled.

The idea would be that you would build binaries using a native GCC compiler installed from one of these RHEL 6 DevTools packs and then deploy the binaries to other RHEL 6 machines that don't have the DevTools installed. Will that work?

bartlettroscoe commented 7 years ago

As noted in the new issue #1465, it looks like Thyra is already free from needing to support C++98 (but need to ask to confirm that to be sure).

That means that the only packages needing to still support C++98 with CC 4.4.7 for Xyce are:

Of those, the ones being actively developed (e.g. by ATDM) that really would benefit from being able to use C++11 are Teuchos and NOX (and perhaps Sacado). Therefore, there is still a need to free these packages from needing to support C++98 so this issue still has value and need to be worked.

jwillenbring commented 7 years ago

A meeting to discuss if SEMS plans for broad C++11 compiler availability are sufficient for XYCE is scheduled for 7/27.

bartlettroscoe commented 6 years ago

From Jim at SART Meeting:

Plan is to get Trilinos 12.12 release out. Then Xyce will use that for C++98 support.

ibaned commented 6 years ago

Plan is to get Trilinos 12.12 release out. Then Xyce will use that for C++98 support.

Is there a timeline for this?

hkthorn commented 6 years ago

@ibaned Xyce has given the green light for Trilinos 12.12 to be released. We have tested against the release branch successfully. Talked to @jwillenbring and release will hopefully happen this week.

ibaned commented 6 years ago

It looks like the release branch for 12.12 and the 12.12.1 tag are both up. I think that means:

bartlettroscoe commented 6 years ago

I think that means:

  • We are now allowed to start making commits to develop which use C++11 features in any Trillions package, including Teuchos and Thyra

Is this really true? @jwillenbring and @hkthorn, can you confirm this?

ibaned commented 6 years ago

Any word on this? I noticed @maherou marked it as "Blocked"... not sure what it is blocked on.

mhoemmen commented 6 years ago

For Teuchos, did we talk to the Dakota folks? They definitely use Teuchos, though they may either have moved to C++11 or have frozen their Teuchos version by now.

bartlettroscoe commented 6 years ago

For Teuchos, did we talk to the Dakota folks? They definitely use Teuchos, though they may either have moved to C++11 or have frozen their Teuchos version by now.

Dakota snapshots their own version of Teuchos so this would not impact them until they update Teuchos (which they can control).

mhoemmen commented 6 years ago

@bartlettroscoe I just e-mailed Brian Adams to see if he wants to chime in. Dakota used to patch Teuchos anyway; not sure if they still do that, but it suggests that they would be willing to wait a bit before adopting a new Teuchos with a new C++ standard requirement.

briadam commented 6 years ago

No problem for Dakota, thanks for considering us! Dakota now requires a C++11 compliant compiler so it's a non-issue. However, to close the thread, @bartlettroscoe and @mhoemmen are correct that we snapshot Teuchos (and we're currently on v.ANCIENT = 11.0.3, plus critical patches as Mark said).

Why ancient? We configure Teuchos with CMake add_subdirectory and it proved too hard to get that approach to work with newer versions of TriBITS. I have a list of small adjustment requests to TriBITS that would enable this to work again, but would want to see which still remain with a modern version of Trilinos/TriBITS, and then could file some issues for those that seem worth pursuing.

ibaned commented 6 years ago

Okay, so Xyce and Dakota have both been considered. At this point it is unclear what else could be blocking this issue. If anyone knows, please post a comment, thanks.

jwillenbring commented 6 years ago

I will follow up with @dmvigi to see if there are blockers. We should get one last status check on the future plans for the SEMS compiler toolchain so we can make sure XYCE’s needs will be met. Other than that, I see no blockers.

jwillenbring commented 6 years ago

I heard back from @dmvigi and they are actively working to provide XYCE with a solution. XYCE ran into some issues with the preliminary version and are currently digging into what the issue is.

@hkthorn can report back when she has more specific information.

ibaned commented 6 years ago

As of commit 0f91914291b2c71ee170b57c313d6806a07f305b, Teuchos unconditionally includes <type_traits>, which is a C++11 feature.

etphipp commented 6 years ago

So can I finally drop C++98 support for Sacado? Xyce has always been the blocker for doing so.

rppawlo commented 6 years ago

So can I finally drop C++98 support for Sacado? Xyce has always been the blocker for doing so.

Same question for NOX/LOCA.

jwillenbring commented 6 years ago

@etphipp @rppawlo I heard back officially today that we can drop C++98 support from @tvrusso.

I have disabled the nightly build to protect C++98 compatibility that was running for XYCE. I am going to close this issue.