Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify and improve wrappers #261

Merged
merged 40 commits into from
May 13, 2019
Merged

Conversation

sethrj
Copy link
Collaborator

@sethrj sethrj commented Feb 4, 2019

Infrastructure changes:

aprokop and others added 23 commits January 30, 2019 15:57
The -cpp option interferes with CMake's Ninja generator.
Also simplify literal types in the test code: this cleans up a number of
warnings about conversions, including an unintentional conversion to
single-precision reals (the literal 3.0 was used).

Also commented out unused functions that were generating warnings.
This also removes a couple of functions that were returning arrayviews
*by reference* (e.g. getGlobalRowView), so the wrappers that were in
place actually did nothing.
Gets rid of the 'FIXME' since SWIG now knows about Import when
instantiating Export.
@sethrj
Copy link
Collaborator Author

sethrj commented Feb 4, 2019

@aprokop Can you direct me how to see the test messages (and possibly the Flang backtrace) from the failing tests? They all pass on my machine...

@aprokop
Copy link
Collaborator

aprokop commented Feb 4, 2019

The latest build (can you not access the "Details" about to see Jenkins PR?) fails in both GCC and Flang with SegFault in teuchos_plist test. No backtrace is available. You (or I) can reproduce that by firing up a Docker container and running the build from there.

@sethrj
Copy link
Collaborator Author

sethrj commented Feb 4, 2019

Yeah I saw the "details" listing the failing tests, but I couldn't see what it reported as the failure. I don't have Docker set up on my machine, perhaps we could get together sometime and debug these failing tests on yours?

Updated to latest SWIG. Currently fails to compile:

```
       call A%getGlobalRowView(gblrow, cgview(1:nnz), csview(1:nnz))
                                                                   1
Error: Type mismatch in argument 'indices' at (1); passed INTEGER(8) to CLASS(swigtype_teuchos__arrayviewt_long_long_const_t)
```
@aprokop
Copy link
Collaborator

aprokop commented Feb 6, 2019

@sethrj oh, boy, you've been prolific! Will review this today.

@sethrj
Copy link
Collaborator Author

sethrj commented Feb 6, 2019

@aprokop Sweet. I also just pushed a fix for #216 that includes some basic ArrayRCP wrapping, simplifying the manual code even further.

Also clearing initial pointer assignments in the test.
- Changes intent of mutable classes to intent(in) since we only modify
the pointed-to-class, not the pointer
- Fixes modification of "other" pointer during assignment, which would
access possibly off-limits Fortran memory
@sethrj
Copy link
Collaborator Author

sethrj commented Feb 12, 2019

@aprokop I think the changes in this branch might have fixed some of the crashes @mattbement (I think?) was seeing on Titan. At least, it'd be good to take another shot at running previously failing tests with this branch.

- Updates memory management/assignment semantics
- Fixes some latent type issues
Copy link
Collaborator

@aprokop aprokop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! A bunch of code cleanup, and increased maintainability.

Careful review is really hard, though. For example, making sure that nothing in +-1 issues changed. Kind of wish we had all those tests in, already.

I did spend few hours going through code and commits, and am mostly OK with them.

Few issues seems to have creeped in, though, that I would like to have addressed, mostly about Kokkos:

  1. Removing some ignores in TpetraMap brought back the constructors with node. We don't want any of those.
  2. MultiVector has about 4 or 5 versions of dot, norm*. We only want to leave one of them right now.
  3. TpetraCrsMatrix has some constructors with Kokkos now, which is not what we want.
  4. I'm not sure about Teuchos::Array constructor from Teuchos::ArrayView. Is it used somewhere?
  5. I'd like to have a clean SWIG generation without any warnings. Right now it has some sumInto{Local,Global}Values.

Overall, I think it's necessary to update ROADMAP.md with all the changes. It's going to take some time and effort, though, to figure out which functions were modified/added/removed.

@sethrj
Copy link
Collaborator Author

sethrj commented Mar 27, 2019

@aprokop I had hoped that the maintenance gain of not having to duplicate a bunch of Tpetra constructor declarations in SWIG would outweigh the penalty of having a few useless (Kokkos node) constructors. 😔

I have previously thought about implementing a feature that would allow particular classes/types to cause declarations where they're used (such as constructors) to be ignored automatically. I think I have a means of doing this, but it's not typical/standard SWIG practice to do. That hasn't stopped us before though 😉

@tjfulle
Copy link
Collaborator

tjfulle commented Mar 27, 2019

It may be worth noting that Trilinos seems to have (finally) adopted (re-adopted?) a release cycle. Tpetra is pushing through a bunch of deprecations now so that code can be removed this spring summer. Things on the docket for removal are:

  • template arguments other than Scalar
  • DynamicProfile - only StaticProfile CrsMatrix and CrsGraph will be available after April 16th (or later)

Can anything be done now to create Tpetra wrappers without the template arguments?

@aprokop
Copy link
Collaborator

aprokop commented Mar 28, 2019

* `DynamicProfile` - only `StaticProfile` `CrsMatrix` and `CrsGraph` will be available after April 16th (or later)

@tjfulle You mean DynamicProfile would just be deprecated, right?

Can anything be done now to create Tpetra wrappers without the template arguments?

Not sure what you mean here. Right now we hardcode the template arguments. If Tpetra leaves just Scalar, we still need to pass that through, right?

@tjfulle
Copy link
Collaborator

tjfulle commented Mar 28, 2019

@aprokop DynamicProfile will be marked deprecated on the minor release made on/around April 16. We plan to have DynamicProfile removed from the code by the next major release. I'm not certain exactly how that will be done, but it is possible that we will start removing code from the develop branch shortly thereafter.

@sethrj
Copy link
Collaborator Author

sethrj commented May 9, 2019

@aprokop I think I've addressed all the feedback: everything that had Kokkos types is now gone.

As to the remaining question about Teuchos::Array: the constructor allows creation of an Array from a fortran array pointer.

@sethrj sethrj requested a review from aprokop May 9, 2019 16:55
@aprokop
Copy link
Collaborator

aprokop commented May 13, 2019

So the %fortranonlywrapped is the new keyword to skip things? Cool! It is off by default to follow usual SWIG approach?

@aprokop aprokop merged commit 808293e into trilinos:master May 13, 2019
@sethrj
Copy link
Collaborator Author

sethrj commented May 14, 2019

Yep!

@sethrj sethrj deleted the modernize-swig branch May 22, 2019 20:17
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants