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

Organize and add examples #3820

Merged
merged 8 commits into from
Oct 18, 2023

Conversation

spyridon97
Copy link
Contributor

@spyridon97 spyridon97 commented Sep 20, 2023

This PR performs the following tasks:

  1. organizes existing examples
  2. adds (most of) the examples from ADIOS2-Examples
  3. disables by default BUILD_TESTING, and ADIOS2_BUILD_EXAMPLES
  4. add readme.md for each example directory and provides a suggested order of checking the examples

This resolves #3806 and (partially?) #3795

Fixes: #3806

@vicentebolea
Copy link
Collaborator

Good work here, few things:

  • You can reformat the code in bulk with sudo ./scripts/developer/run-clang-format.sh
  • As we have much more examples than before how about we disable them by default with aDIOS_BUILD_EXAMPLES option defaulting to off but we enable it in our CI builds.

@anagainaru
Copy link
Contributor

Good work here, few things:

  • You can reformat the code in bulk with sudo ./scripts/developer/run-clang-format.sh
  • As we have much more examples than before how about we disable them by default with aDIOS_BUILD_EXAMPLES option defaulting to off but we enable it in our CI builds.

I would honestly do the same with the tests if possible (-DADIOS2_BUILD_TESTING=OFF). Users don't really need them.

@spyridon97 spyridon97 force-pushed the organize-and-add-examples branch 2 times, most recently from 0ed3994 to c93e0fb Compare September 22, 2023 17:49
@spyridon97
Copy link
Contributor Author

@vicentebolea @anagainaru This PR is ready for review. I tried to reformat, but it does not work for python files for some reason locally, i don't even get the same output as the CI machine

~/Programming/Cpp/ADIOS2 organize-and-add-examples ?2 > ./scripts/developer/run-clang-format.sh
[sudo] password for spiros.tsalikis: 
---------- Begin ENV ----------
DISTTAG=f38container
FBR=f38
FGC=f38
HOME=/root
HOSTNAME=f33d9af01d56
OLDPWD=/
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/root/adios2
SHLVL=1
TERM=xterm
_=/usr/bin/env
----------  End ENV  ----------
~/Programming/Cpp/ADIOS2 organize-and-add-examples ?2 > 

@spyridon97 spyridon97 self-assigned this Sep 22, 2023
@vicentebolea
Copy link
Collaborator

@spyridon97

but it does not work for python files for some reason locally, i don't even get the same output as the CI machine

Yep, the script for python is in scripts/ci/scripts/run-flake8.sh and it does not edit the source code only complains. You will have to edit those files, perhaps a black ./examples will do it, otherwise you might have to go one-by-one and and make sure that they pass.

Copy link
Collaborator

@vicentebolea vicentebolea left a comment

Choose a reason for hiding this comment

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

Great job here, this is looking good!

The review has taken me a while since it is 406 files changes, I could not go onto details in the added parts, but that is something for the CI. I left some notes. Other notes:

  • We will need to reformat the shell script too to pass the linters, After you fix the python formatting you will see the errors.
  • We might have to disable testing in the static builds if they fail since we hit the space limit in github actions runners.
  • Once you get the smallest and most succint cmake partern for testing that whether the example is part of the adios worktree apply it to all the tests.

Once again thanks for taking care of this, this is indeed a very laborious effort, but it is looking great 👍 I will be tomorrow online for afew hours before I leave for vacations I will have another look then

testing/install/EnginePlugin/CMakeLists.txt Show resolved Hide resolved
examples/useCases/insituGlobalArrays/CMakeLists.txt Outdated Show resolved Hide resolved
examples/simulations/lorenz_ode/CMakeLists.txt Outdated Show resolved Hide resolved
examples/plugins/engine/CMakeLists.txt Outdated Show resolved Hide resolved
examples/plugins/engine/CMakeLists.txt Outdated Show resolved Hide resolved
examples/plugins/operator/CMakeLists.txt Outdated Show resolved Hide resolved
examples/plugins/CMakeLists.txt Show resolved Hide resolved
Copy link
Contributor

@anagainaru anagainaru left a comment

Choose a reason for hiding this comment

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

Nice work, this was a lot of reorganizing ! I tried to look over most of the changes (source files and not cmake) but there were a lot of files modified so I am sure I missed things.

I built ADIOS2 with your branch on my laptop and the Tests were built so the default is not OFF. This needs to be fixed or if you want to leave them, the build scripts in the scripts folder need to have -D BUILD_TESTING=OFF (you removed this).

One additional comment:

  • In some cases our examples use #if ADIOS2_USE_MPI and in other we check in cmake and do not generate the example if MPI is not present. Is there a reason a code uses one or the other?

This is more a discussion with @vicentebolea / @pnorbert / @eisenhauer, but didn't we decide we want to keep the complex examples in ADIOS2-Examples and import them in the docs from there? I really don't think we need all of these examples in the ADIOS2 repo (Kokkos-{backend} for each backend is a bit much, it makes sense in a repo dedicated to ADIOS2 examples but not in the main library). I am assuming this was discussed when I wasn't there but I really don't think we should bulk up the library with more than basic examples.

examples/ReadMe.md Show resolved Hide resolved
@vicentebolea
Copy link
Collaborator

This is more a discussion with @vicentebolea / @pnorbert / @eisenhauer, but didn't we decide we want to keep the complex examples in ADIOS2-Examples and import them in the docs from there? I really don't think we need all of these examples in the ADIOS2 repo (Kokkos-{backend} for each backend is a bit much, it makes sense in a repo dedicated to ADIOS2 examples but not in the main library). I am assuming this was discussed when I wasn't there but I really don't think we should bulk up the library with more than basic example

I understood from our last few conversations that the consensus is to move all the adios2-examples examples to our main repo and merge then with our main repo examples. What I originally proposed was to simply move the readthedocs for adios2-examples our main repo but in the meeting the consensus was to also move the examples itself. The reason was that it is confusing as it is having two sets of examples. At the end of the day i do not consider it a big deal eitherway. Two things to watch out:

  • We might want to trim down the number of examples.
  • The examples source coding standards should not be held to the same level as the aDIOS2 source code, this is unnecessary effort and it will slow down the maintenance of them.

Connecting to the previous point, we might want the examples to be a git submodule so that:

  • We do not have duplication of code and the adios2-examples (criteria 1)
  • We can have less strict coding standards (Criteria 2)
  • As it is part of the adios2 main repo too, it will be kept uptodate. (Criteria 3)

The drawback is that we would have to bump the adios2-example commit version time to time, we can add an automatized rule that it does it whenever something is commited in master in adios2-examples.

What do you all think about it?

@spyridon97
Copy link
Contributor Author

I built ADIOS2 with your branch on my laptop and the Tests were built so the default is not OFF

I fixed that now.

@spyridon97
Copy link
Contributor Author

  • In some cases our examples use #if ADIOS2_USE_MPI and in other we check in cmake and do not generate the example if MPI is not present. Is there a reason a code uses one or the other?

Yes, some examples can compile with both mpi on and off, and some can compile only with mpi on.

@spyridon97 spyridon97 force-pushed the organize-and-add-examples branch 4 times, most recently from c1ba1c5 to 523f5d9 Compare September 25, 2023 19:37
@anagainaru
Copy link
Contributor

Yes, some examples can compile with both mpi on and off, and some can compile only with mpi on.

I was mainly asking if there is a reason for choosing one or the other? It's not a huge deal, we can deal with this some other time.

Norbert convinced me to go with this version of examples in the main repo so I will remove my request for changes.

anagainaru
anagainaru previously approved these changes Sep 26, 2023
@spyridon97
Copy link
Contributor Author

spyridon97 commented Sep 27, 2023

@pnorbert I would appreciate checking that all the simulation examples work as expected along with their scripts.

@scottwittenburg scottwittenburg dismissed vicentebolea’s stale review October 3, 2023 18:15

Requests addressed and Vicente is out for a couple more weeks.

@vicentebolea
Copy link
Collaborator

@spyridon97 my changes are ready

Copy link
Collaborator

@vicentebolea vicentebolea left a comment

Choose a reason for hiding this comment

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

Last round of changes, everything else looks good. I have confirmed that we build the examples in every job in the CI. We might have to adjust this later to disable examples in some already slow builds (static builds probably). Make the discussed changes, rebase to the last master and we can have this merged.

Fantastic work @spyridon97 🎉

CMakeLists.txt Outdated Show resolved Hide resolved
@vicentebolea
Copy link
Collaborator

I have made the changes to speedup the process

@spyridon97
Copy link
Contributor Author

Last round of changes, everything else looks good. I have confirmed that we build the examples in every job in the CI. We might have to adjust this later to disable examples in some already slow builds (static builds probably). Make the discussed changes, rebase to the last master and we can have this merged.

Fantastic work @spyridon97 🎉

What discussed changes do you refer to that i have not already done?

vicentebolea
vicentebolea previously approved these changes Oct 17, 2023
@vicentebolea
Copy link
Collaborator

@spyridon97 I have also remove the mark_advance(BUILD_TESTING) since it is a very common CMAKE variable that the user might expect it to see it when doing cmake -L or ccmake.

@vicentebolea
Copy link
Collaborator

If you approve the latest changes please merge after the CI passes.

@vicentebolea vicentebolea force-pushed the organize-and-add-examples branch 2 times, most recently from aa77e3c to bd89672 Compare October 17, 2023 22:57
spyridon97 and others added 8 commits October 17, 2023 19:11
1) Make all examples individually compilable
2) Make examples' executable names be consistent
3) Move certain examples in the right folders
4) Rename certain examples for clarity
5) Make all examples installable
6) Fix Python formatting using black
7) Add licence documentation wherever it's missing
1) Make all examples individually compilable
2) Make examples' executable names be consistent
3) Rename certain examples for clarity
4) Make all examples installable
5) Fix Python formatting using black
6) Add licence documentation wherever it's missing
@spyridon97 spyridon97 merged commit a43d013 into ornladios:master Oct 18, 2023
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move ADIOS2-examples inside the main ADIOS2 repository
3 participants