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

Allow EGSnrc applications to run from any directory #1212

Open
2 tasks
ftessier opened this issue Nov 3, 2024 · 8 comments
Open
2 tasks

Allow EGSnrc applications to run from any directory #1212

ftessier opened this issue Nov 3, 2024 · 8 comments
Assignees

Comments

@ftessier
Copy link
Member

ftessier commented Nov 3, 2024

Problem Description

EGSnrc currently requires input files for an application to reside inside the application's directory in $EGS_HOME. This is also where output files are written. This constraint makes managing multiple projects cumbersome, as the directory becomes cluttered with input and output files from unrelated projects over time.

Proposed Solution

Enable EGSnrc applications to run from any directory, allowing simulation input and output to be isolated in their own project-specific directories. The application directory in $EGS_HOME would still be used for source files, and users could continue to run applications there as before. However, it should also be possible to run applications from any other location. This would match the expected behaviour of all other commands entered in the terminal.

Ideally, this enhancement would go a step further and also allow compilation of any EGSnrc application code anywhere. This change would essentially make $EGS_HOME obsolete for regular usage, allowing EGSnrc to function more like a standard software library toolkit.

Alternatives Considered

Long-time users of EGSnrc often develop workarounds, such as:

  • Moving input and output files to a project directory after completion.
  • Using symbolic links to manage files across project directories.
  • Cloning and configuring a new EGSnrc instance for each project.

While these methods work, they are cumbersome and error-prone.

Steps to Implement

  • Identify all dependencies on the application directory path for input and output in EGSnrc.
  • Update every instance to use the current directory (./) for input and output.

Feedback on this proposal is welcome, especially regarding potential issues or improvements for implementation.

@crcrewso
Copy link
Contributor

crcrewso commented Nov 4, 2024

The impact of this sounds quite widespread, would it be better to break this into two stages

  1. Break each code into subfolders
    • bin
    • input
    • scratch
    • output
  2. Once all impacts have been discovered and tested, then consider moving each folder to a more modern location

I say this after having set up a git repositor of $EGS_HOME specially configured so that my input files don't go disappearing on me

@ftessier
Copy link
Member Author

ftessier commented Nov 4, 2024

I am not sure what you mean @crcrewso, so in turn I wonder if what I said was clear. All I am suggesting is that the directory ./ becomes the default first path for input and output files for any EGSnrc application. Then it can move on to the other traditional paths like the egs_home directory etc.

I don't expect this to be a breaking change. Application could still compile to egs_home/bin, but one should be able to run them from any location.

@crcrewso
Copy link
Contributor

crcrewso commented Nov 6, 2024

[..] in turn I wonder if what I said was clear.

I reread both your post and your response, you were clear, I had been thinking that any change allowing any file location variance would be a breaking change. I can now see what you were going for, any change would be a good one.

My issues with organization have been:

  1. How full each application folder gets (technical)
  2. With applications like dosxyznrc I've had to play with the mortran dimension limits and haven't kept track of when I need to recompile (technical/human)
  3. Archiving results and their source inp so that I don't accidently modify the source file (human)

@ftessier
Copy link
Member Author

ftessier commented Nov 7, 2024

I agree with all three points you raised: ongoing grief when using EGSnrc, for many (most?) EGSnrc users, myself included.

  1. My workaround is to use symlinks, but more often than not I use rsync -av between a specific project/ directory (outside of EGSnrc/) and an application directory such as $EGS_HOME/egs_chamber, to keep the latter pristine otherwise.

  2. Fixed array sizes in F77 are a significant pain point. I am in the habit of adding my egs_home/ to git (after configuration), to keep track of modifications and easily diff against the pristine source code. Note that since by default egs_home is git ignored, you can git init your egs_home as a separate repo inside EGSnrc/ without conflict! I also make before launching new simulations, especially after not using the app in a while.

  3. I usually rsync -av the entire app directory (and density correction files!) in my separate projects folder (outside of EGSnrc), so that years later I can diff with the existing version and be able to recover where I left off. Another trick which I use for quick simulations while I am in the middle of some other simulations, is to clone and configure EGSnrc all over again in a separate location for that quick one off. In a way, that is one sure way to reproduce your results: one EGSnrc clone per project!! 😄

@crcrewso
Copy link
Contributor

crcrewso commented Nov 7, 2024

I just had a whole new idea.
What if we created a new front end, that handled projects, symlinks, all these new features, and would leave the existing code alone. I'm thinking python might be the most maintainable. We wouldn't have to deal with teaching users about simlinks or rsync?

@ftessier
Copy link
Member Author

I like the way you think! 😄 For a long time I pondered on an overall egs command, that could dispatch sub-commands, e.g., egs chamber ..., egs configure ..., with perhaps man pages for egs-chamber, egs-configure, etc. This is inspired by the way git and other modern packages work, manifestly 😉

But in the short term, why even build a front end to maintain an outdated system that is rigid when it comes to file locations etc. If we simply allow ./ as the first path, and have the EGSnrc bin directory in the path, I reckon it would behave like most other software, and could be done quickly.

Interestingly, when we teach an EGSnrc course, the participants that know linux the most are the one struggling with the EGSnrc file system rigidity the most, because it does not behave as expected!

@crcrewso
Copy link
Contributor

But in the short term, why even build a front end to maintain an outdated system that is rigid when it comes to file locations etc.

My worry is that identifying all of the references to file locations is a higher risk than just wrapping the existing code and leaving it alone. I know, a kludge.

@ftessier
Copy link
Member Author

Yes, once I start looking I might change my mind! 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants