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

ROL: correct warnings in examples and tests #2364

Closed
wants to merge 1 commit into from

Conversation

prwolfe
Copy link
Contributor

@prwolfe prwolfe commented Mar 12, 2018

The tests were mostly signed/unsigned comparisons
which I cast to match. I did consider changing
the types, but other comparisons in the same code
would have required a cast in the opposite direction
so that was pointless. The example code was
complaining about unused variables. I did lleave those
in place but commented out so that the example is still
there but the compiler does not complain. If someone
wanted to instead use those in some way that would be good.

closes issue #2284

@trilinos/

Description

Motivation and Context

Related Issues

  • Closes
  • Blocks
  • Is blocked by
  • Follows
  • Precedes
  • Related to
  • Part of
  • Composed of

How Has This Been Tested?

Screenshots

Checklist

  • My commit messages mention the appropriate GitHub issue numbers.
  • My code follows the code style of the affected package(s).
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the code contribution guidelines for this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • No new compiler warnings were introduced.
  • These changes break backwards compatibility.

Additional Information

The tests were mostly signed/unsigned comparisons
which I cast to match.  I did consider changing
the types, but other comparisons in the same code
would have required a cast in the opposite direction
so that was pointless.  The example code was
complaining about unused variables. I did lleave those
in place but commented out so that the example is still
there but the compiler does not complain.  If someone
wanted to instead use those in some way that would be good.

closes issue trilinos#2284
@prwolfe prwolfe self-assigned this Mar 12, 2018
@prwolfe prwolfe requested a review from eric-c-cyr March 12, 2018 13:33
@bartlettroscoe bartlettroscoe added the stage: in progress Work on the issue has started label Mar 12, 2018
@trilinos-autotester
Copy link
Contributor

Status Flag 'Pre-Test Inspection' - Auto Inspected - Inspection Is Not Necessary for this Pull Request.

@trilinos-autotester
Copy link
Contributor

Status Flag 'Pull Request AutoTester' - Testing Jenkins Projects:

Pull Request Auto Testing STARTING (click to expand)

Build Information

Test Name: Trilinos_autotester_test

  • Build Num: 476
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
COMPILER_MODULE sems-gcc/4.8.4
JENKINS_BUILD_TYPE Release
JENKINS_COMM_TYPE MPI
JENKINS_DO_COMPLEX OFF
JENKINS_JOB_TYPE Experimental
MPI_MODULE sems-openmpi/1.8.7
PULLREQUESTNUM 2364
TEST_REPO_ALIAS TRILINOS
TRILINOS_SOURCE_BRANCH issue2284
TRILINOS_SOURCE_REPO https://github.com/prwolfe/Trilinos
TRILINOS_SOURCE_SHA 12df728
TRILINOS_TARGET_BRANCH develop
TRILINOS_TARGET_REPO https://github.com/trilinos/Trilinos
TRILINOS_TARGET_SHA c6b31cd

Build Information

Test Name: Trilinos_pullrequest_gcc_4.9.3

  • Build Num: 341
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
COMPILER_MODULE sems-gcc/4.9.3
JENKINS_BUILD_TYPE Release
JENKINS_COMM_TYPE MPI
JENKINS_DO_COMPLEX OFF
JENKINS_JOB_TYPE Experimental
MPI_MODULE sems-openmpi/1.8.7
PULLREQUESTNUM 2364
TEST_REPO_ALIAS TRILINOS
TRILINOS_SOURCE_BRANCH issue2284
TRILINOS_SOURCE_REPO https://github.com/prwolfe/Trilinos
TRILINOS_SOURCE_SHA 12df728
TRILINOS_TARGET_BRANCH develop
TRILINOS_TARGET_REPO https://github.com/trilinos/Trilinos
TRILINOS_TARGET_SHA c6b31cd

Build Information

Test Name: Trilinos_pullrequest_gcc_4.8.4

  • Build Num: 58
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
COMPILER_MODULE sems-gcc/4.8.4
JENKINS_BUILD_TYPE Release
JENKINS_COMM_TYPE MPI
JENKINS_DO_COMPLEX OFF
JENKINS_JOB_TYPE Experimental
MPI_MODULE sems-openmpi/1.8.7
PULLREQUESTNUM 2364
TEST_REPO_ALIAS TRILINOS
TRILINOS_SOURCE_BRANCH issue2284
TRILINOS_SOURCE_REPO https://github.com/prwolfe/Trilinos
TRILINOS_SOURCE_SHA 12df728
TRILINOS_TARGET_BRANCH develop
TRILINOS_TARGET_REPO https://github.com/trilinos/Trilinos
TRILINOS_TARGET_SHA c6b31cd

Using Repos:

Repo: TRILINOS (prwolfe/Trilinos)
  • Branch: issue2284
  • SHA: 12df728
  • Mode: TEST_REPO

Pull Request Author: prwolfe

@trilinos-autotester
Copy link
Contributor

Status Flag 'Pull Request AutoTester' - Jenkins Testing: all Jobs PASSED

Pull Request Auto Testing has PASSED (click to expand)

Build Information

Test Name: Trilinos_autotester_test

  • Build Num: 476
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
COMPILER_MODULE sems-gcc/4.8.4
JENKINS_BUILD_TYPE Release
JENKINS_COMM_TYPE MPI
JENKINS_DO_COMPLEX OFF
JENKINS_JOB_TYPE Experimental
MPI_MODULE sems-openmpi/1.8.7
PULLREQUESTNUM 2364
TEST_REPO_ALIAS TRILINOS
TRILINOS_SOURCE_BRANCH issue2284
TRILINOS_SOURCE_REPO https://github.com/prwolfe/Trilinos
TRILINOS_SOURCE_SHA 12df728
TRILINOS_TARGET_BRANCH develop
TRILINOS_TARGET_REPO https://github.com/trilinos/Trilinos
TRILINOS_TARGET_SHA c6b31cd

Build Information

Test Name: Trilinos_pullrequest_gcc_4.9.3

  • Build Num: 341
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
COMPILER_MODULE sems-gcc/4.9.3
JENKINS_BUILD_TYPE Release
JENKINS_COMM_TYPE MPI
JENKINS_DO_COMPLEX OFF
JENKINS_JOB_TYPE Experimental
MPI_MODULE sems-openmpi/1.8.7
PULLREQUESTNUM 2364
TEST_REPO_ALIAS TRILINOS
TRILINOS_SOURCE_BRANCH issue2284
TRILINOS_SOURCE_REPO https://github.com/prwolfe/Trilinos
TRILINOS_SOURCE_SHA 12df728
TRILINOS_TARGET_BRANCH develop
TRILINOS_TARGET_REPO https://github.com/trilinos/Trilinos
TRILINOS_TARGET_SHA c6b31cd

Build Information

Test Name: Trilinos_pullrequest_gcc_4.8.4

  • Build Num: 58
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
COMPILER_MODULE sems-gcc/4.8.4
JENKINS_BUILD_TYPE Release
JENKINS_COMM_TYPE MPI
JENKINS_DO_COMPLEX OFF
JENKINS_JOB_TYPE Experimental
MPI_MODULE sems-openmpi/1.8.7
PULLREQUESTNUM 2364
TEST_REPO_ALIAS TRILINOS
TRILINOS_SOURCE_BRANCH issue2284
TRILINOS_SOURCE_REPO https://github.com/prwolfe/Trilinos
TRILINOS_SOURCE_SHA 12df728
TRILINOS_TARGET_BRANCH develop
TRILINOS_TARGET_REPO https://github.com/trilinos/Trilinos
TRILINOS_TARGET_SHA c6b31cd

@trilinos-autotester
Copy link
Contributor

Status Flag 'Pre-Merge Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging
NO REVIEWS HAVE BEEN PERFORMED ON THIS PULL REQUEST!

@trilinos-autotester
Copy link
Contributor

All Jobs Finished; status = PASSED, However Inspection must be performed before merge can occur...

@mhoemmen
Copy link
Contributor

@prwolfe I created a ROL issue to mirror this PR: trilinos/trilinos.github.io#10

@mhoemmen mhoemmen requested review from gregvw and dridzal March 12, 2018 18:10
Copy link
Contributor

@dridzal dridzal left a comment

Choose a reason for hiding this comment

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

In principle this looks fine, but I have a question. We would like to use more C++11 features in ROL, and have started converting some code to use 'auto', for example. Is there a cleaner way to fix these type mismatch issues by using 'auto'?

@trilinos-autotester
Copy link
Contributor

Status Flag 'Pre-Merge Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging
THE LAST COMMIT TO THIS PULL REQUEST HAS BEEN REVIEWED, BUT NOT ACCEPTED OR REQUIRES CHANGES

@trilinos-autotester
Copy link
Contributor

All Jobs Finished; status = PASSED, However Inspection must be performed before merge can occur...

@prwolfe
Copy link
Contributor Author

prwolfe commented Mar 12, 2018

@dridzal - I am not sure that auto would help here as no matter what the compiler assigned at least one comparison would need a cast. In this case an unsigned int is being compared to both signed and unsigned int's. Nice idea otherwise (I have normally used this for pointers instead of integral types but it should work.)

@gregvw
Copy link
Contributor

gregvw commented Mar 12, 2018

Warnings due to signed/unsigned comparisons have been an ongoing issue since there have been many instances in the code where containers like std::vector have been indexed with with int type (probably because ROL::Vector::dimension() returns int). The correct type for indexing is std::vector::size_type, which is unsigned and is the type that the size() method returns in the (for loop) comparisons. auto can be used to loop over vectors quite easily if you only want the elemental values and don't explicitly need the index.

You can do

for( auto element : myvector ) foo(element);

but something like

for( auto i=0; i<myvector.size(); ++i ) foo( myvector.at(i) );

doesn't solve the problem because the auto type deduction is set by the i=0 assignment which is still an int (you could do i=0u I guess).

A better approach if you are doing something where using the iterator would be clunky would be something like

using size_type = typename std::vector<ValueType,AllocatorType>::size_type;
for( size_type i=0; i<myvector.size(); ++i ) bar( myvector.at(i), i );

It would be nice to ultimately allow a generic integral type for dimension and basis.

I already pushed the unused warning fix for the tempus example_01 to the ROL dev fork last week.

Otherwise, these look fine to me.

@dridzal
Copy link
Contributor

dridzal commented Mar 12, 2018

If @gregvw has already pushed these changes in the standalone ROL repo, then we may get a conflict when merging the ROL and Trilinos repos. To provide some background, ROL development takes place in a separate private github repo (essentially a snapshot of Trilinos), and we occasionally perform a two-way merge with Trilinos proper. Don't know how to proceed considering the potential merge conflict.

@gregvw
Copy link
Contributor

gregvw commented Mar 12, 2018

Is there a "line item veto" for pull requests?

@trilinos-autotester
Copy link
Contributor

Status Flag 'Pre-Merge Inspection' - SUCCESS: The last commit to this Pull Request has been INSPECTED AND APPROVED by [ dridzal ]!

@trilinos-autotester
Copy link
Contributor

Status Flag 'Pull Request AutoTester' - Pull Request MUST BE MERGED MANUALLY BY Project Team - Master Automerge is disabled (in .cfg file)

@prwolfe
Copy link
Contributor Author

prwolfe commented Mar 12, 2018

No line item veto that I know of. I have the PR open for editing by contributors if you wanted to do that, but if you are more comfortable pulling it into your workflow I am fine with that as long as it makes it's way into develop at some point.

@mhoemmen
Copy link
Contributor

However you choose to do this, please please run with -Wall and fix the warnings :)

@trilinos-autotester
Copy link
Contributor

Status Flag 'Pull Request AutoTester' - Pull Request MUST BE MERGED MANUALLY BY Project Team - Master Automerge is disabled (in .cfg file)

Copy link
Contributor

@gregvw gregvw left a comment

Choose a reason for hiding this comment

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

This looks ok to me. We can handle the merge conflict in the tempus example when we sync.

@dridzal
Copy link
Contributor

dridzal commented Mar 13, 2018

I've applied the suggested changes directly to the code in the ROL repo, and am performing a sync with the Trilinos repo right now. If the sync succeeds, we can ignore the PR and close the issue.

@mhoemmen
Copy link
Contributor

@gregvw If you know the right type, just use it for the index variable. Otherwise, use for (auto && x : getVector()) { /* ... */ }.

@dridzal
Copy link
Contributor

dridzal commented Mar 14, 2018

The sync was successful. @prwolfe @mhoemmen How can we confirm that these warnings are gone? Is there a particular build on CDash to watch? Also, if the warnings are indeed gone, will closing this issue also delete the PR?

@prwolfe
Copy link
Contributor Author

prwolfe commented Mar 14, 2018

There is a build to watch and I looked this morning at https://testing.sandia.gov/cdash/index.php?project=Trilinos&parentid=3437562 and ROL is clean. I am abandoning and closing this and the issue as well.

Thanks!

@prwolfe prwolfe closed this Mar 14, 2018
@bartlettroscoe bartlettroscoe removed the stage: in progress Work on the issue has started label Mar 14, 2018
@prwolfe prwolfe deleted the issue2284 branch April 19, 2018 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants