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

Version info #11

Closed
koldunovn opened this issue Sep 4, 2020 · 21 comments
Closed

Version info #11

koldunovn opened this issue Sep 4, 2020 · 21 comments

Comments

@koldunovn
Copy link
Member

Discussion related to #10 PR

@pgierz thanks for such a fast reaction with a PR :)

I give it a deeper though and now think that retrieving the version number dynamically is not the best way to do it:

  • I don't lake git dependency. It maybe installed on all relevant machines now, but we don't know where fesom will be used in the future. I can imagine situation when git will be available on login nodes but not on the compute nodes.
  • The idea is to be able to get the version of the model for debugging. If someone copied the fesom folder, then git folder most probably will be copied as well, so the person can get this information. If .git folder is not present, there is no way we can get the info anyway.
  • Also there are use cases when fesom executable, created with some particular version of the model copied to bin folder in another fesom "installation". So version is something that should be inserted at the moment of compilation.

So I see two possible options - somehow insert the git version at the process of compilation (in this case git should be available on any sane system), or just manually put the tag version. The second option has an advantage of being simpler to communicate and not having git as a dependency. But the first option is more precise and probably much more useful.

Would be nice to have @patrickscholz and @dsidoren opinions on this :)

@pgierz
Copy link
Member

pgierz commented Sep 4, 2020

@koldunovn, thinking about it, I agree that doing it at runtime is also not the best idea. I also find that doing it at compile-time would be a nice idea (less things for the developers to remember when making a new release)

If I understand correctly, you use CMake for building, and the actual CMake command is normally executed inside the besom repository. So, it could be possible to do something like this, assuming cmake can execute system commands:

execute_process("echo 'SUBROUTINE Version'",  OUTPUT_FILE /some/path.f90)
... repeat with other Fortran basics ...
execute_process("git describe")

I'm not a Cmake expert, but something like that could work...

To simply, it might even be easier to just have a dummy template file somewhere with a "UNKNOWN" tag, and then put in the git stuff with an sed command. In that way, you'd always get either a version number, or UNKOWN showing up in your logs...

@hegish
Copy link
Collaborator

hegish commented Sep 11, 2020

Hi guys, I think the build info should be compile time generated and displayed as a build in constant via fesom. Otherwise you could update the repo and have a newer commit sha being displayed without a rebuild. Also, some systems do not have a git installed on the compute nodes and this approach would fail. I can provide a compile time solution next week, if you like.

@hegish
Copy link
Collaborator

hegish commented Sep 11, 2020

What should I put in the info, the
git rev-parse --short HEAD
probably?

@koldunovn
Copy link
Member Author

@hegish would be really nice if you could provide a solution! I think git rev-parse --short HEAD is the best candidate.

@hegish
Copy link
Collaborator

hegish commented Sep 15, 2020

Hi all, I have pushed a branch which prints the compile time git SHA to the main repo. The SHA is determined on each rebuild, so it really reflects the git SHA from the build. I made sure everything still compiles if you do not use the cmake build for some reason, i.e. the fesom sources are still sufficient to build everything.
Let me know what you think about it.

@koldunovn
Copy link
Member Author

@hegish What's the name of the branch? Can you link it here?

@koldunovn
Copy link
Member Author

Nevermind, find it in gitlab, will transpher it here. @hegish I will add you to GitHub, sorry for not doing it earlier.

@hegish
Copy link
Collaborator

hegish commented Sep 15, 2020

Ups, forgot the branch name: "version_info"

@hegish
Copy link
Collaborator

hegish commented Sep 15, 2020

FYI: I already opened a merge request in the main repo.

@koldunovn
Copy link
Member Author

Let's just try to do it here, if you don't mind :)

@hegish
Copy link
Collaborator

hegish commented Sep 15, 2020

No problem, should I push it here?

@koldunovn
Copy link
Member Author

I already did #13

@koldunovn
Copy link
Member Author

@hegish Perfect, thanks a lot, Jan! Merged now.

@koldunovn
Copy link
Member Author

@hegish Ok, maybe I was too fast with merging it :) Now on juwels I have:

[100%] Linking Fortran executable fesom
ld: cannot find -lFALSE
make[2]: *** [src/fesom] Error 1
make[1]: *** [src/CMakeFiles/fesom.dir/all] Error 2
make: *** [all] Error 2

@hegish
Copy link
Collaborator

hegish commented Sep 15, 2020

This error is probably related to a misconfigured linker or environment (i.e. it tries to link a library with the name FALSE). It has nothing to do with the changes of the branch. Are you sure the error did not occur in master before?

@koldunovn
Copy link
Member Author

Just tried it with async_output branch and it works :) So something that was introduced byt the latest changes. Mistral and ollie are OK BTW.

@pgierz
Copy link
Member

pgierz commented Sep 15, 2020

@koldunovn, can you show an example of what is printed? We are adding a function in esm tools which will pull out version numbers from the stdout of the models if they exist, so I can add that of what we search for.

@hegish
Copy link
Collaborator

hegish commented Sep 15, 2020

@koldunovn, does the error also exist with c819797, i.e. master before the merge?

@koldunovn
Copy link
Member Author

@koldunovn
Copy link
Member Author

koldunovn commented Sep 15, 2020

c819797

Just compiled with c819797 on Juwels without problems.

@koldunovn
Copy link
Member Author

Problem is magically solved by itself :)

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

No branches or pull requests

3 participants