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

Cleaning nrnivmodl.in #1781

Merged
merged 27 commits into from
Apr 28, 2022
Merged

Cleaning nrnivmodl.in #1781

merged 27 commits into from
Apr 28, 2022

Conversation

alkino
Copy link
Member

@alkino alkino commented Apr 14, 2022

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Apr 14, 2022

Codecov Report

Merging #1781 (d70e174) into master (548348a) will decrease coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1781      +/-   ##
==========================================
- Coverage   45.49%   45.45%   -0.04%     
==========================================
  Files         551      551              
  Lines      113149   113149              
==========================================
- Hits        51476    51431      -45     
- Misses      61673    61718      +45     
Impacted Files Coverage Δ
src/nrnmpi/bbsmpipack.cpp 81.95% <0.00%> (-10.25%) ⬇️
src/parallel/bbsclimpi.cpp 50.57% <0.00%> (-8.63%) ⬇️
src/parallel/bbssrvmpi.cpp 41.46% <0.00%> (-6.10%) ⬇️
src/parallel/bbs.cpp 74.57% <0.00%> (-1.70%) ⬇️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@alkino alkino marked this pull request as ready for review April 14, 2022 11:42
@pramodk pramodk requested a review from alexsavulescu April 19, 2022 07:55
Copy link
Member

@pramodk pramodk left a comment

Choose a reason for hiding this comment

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

Wouldn't say I have confidence in my BASH skills but overall looks OK to me. (I would have tagged @matz-e but he is off this week as well)

Only prominent thing that came to my mind is that we should have a test that covers compiling of MOD file in a directory containing spaces.

bin/nrnivmodl.in Show resolved Hide resolved
bin/nrnivmodl.in Show resolved Hide resolved
bin/nrnivmodl.in Show resolved Hide resolved
@alkino
Copy link
Member Author

alkino commented Apr 19, 2022

Yes, i agree with that, the whole file is designed and complex for support this and i was not able to find a single file with space in nmodldb!

@pramodk
Copy link
Member

pramodk commented Apr 19, 2022

and i was not able to find a single file with space in nmodldb!

@alkino : actually, it's about the directory path containing spaces? i.e. you can create:

mkdir -p /tmp/drive/Shared with me/
cd /tmp/drive/Shared with me/
# copy some mod files in .
nrnivmodl .

@alkino alkino changed the title Lot of different clean for this file Cleaning nrnivmodl.in Apr 20, 2022
bin/nrnivmodl.in Outdated
Comment on lines 165 to 169
if [ $(echo "\n") ] ; then
newline="\n"
else
newline="\\\\n"
fi
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not convinced by that and I don't understand what it tried to fix. Some problem with bash & windows?

Copy link
Member

Choose a reason for hiding this comment

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

I don't recall exactly, but it would have to have been the result of trial and error to get

echo '
void modl_reg(){
  if (!nrn_nobanner_) if (nrnmpi_myid < 1) {
    fprintf(stderr, "Additional mechanisms from files'$newline'");
' >> mod_func.cpp

to emit a valid line fprintf(stderr, "Additional mechanisms from files\n");
I observe on the mac (zsh) that

% echo "\n"

%

though it is correct on the mac with the bash shell.

Copy link
Member

@nrnhines nrnhines left a comment

Choose a reason for hiding this comment

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

I have no objection to updating to bash syntax from the bog level bourne shell syntax (that was just my habit from autotools days).

Compiling c files was always a possibility. But nowadays, given the shift to c++, has become problematic. No objection to removing that option.

A lot of effort went into the handling of spaces in file paths. That is very common on mac and windows. I don't know much about shopts but if that solves that problem as well, then I'm fine with the change. I agree with @pramodk that a test with several mod files with path spaces would be helpful.

An example of interesting nrnivmodl usage which required some workaround for coreneuron is in the tqperf repository README.md file. I.e.

# The -lcrypto is required for modx/invlfiresha.mod
cp mod/*.mod modx # until allow multiple directories for nrnivmod-core
nrnivmodl -coreneuron -l -lcrypto -loadflags -lcrypto modx

I would rather have written

nrnivmodl -coreneuron -l -lcrypto -loadflags -lcrypto mod modx

If this new version works, as the old one did, with

nrnivmodl -l -lcrypto "./path with spaces/mod" "./path with spaces/modx"

then I approve.

@alkino
Copy link
Member Author

alkino commented Apr 22, 2022

shopt -s nullglob only tell to change *.mod to null instead of keep it raw if there is no mod files

@alkino
Copy link
Member Author

alkino commented Apr 22, 2022

A directory with a space has been added

@alkino
Copy link
Member Author

alkino commented Apr 22, 2022

@nrnhines You mean that you wish that coreneuron support several mod directories. Is it that?

@nrnhines
Copy link
Member

@nrnhines You mean that you wish that coreneuron support several mod directories. Is it that?

Yes. Basically any number of directories that contain mod files and explicit paths to mod files.

@pramodk
Copy link
Member

pramodk commented Apr 22, 2022

@nrnhines You mean that you wish that coreneuron support several mod directories. Is it that?

Yes. Basically any number of directories that contain mod files and explicit paths to mod files.

@nrnhines : Just to clarify here though: currently nrnivmodl-core supports only single directory i.e. no multiple directories or file as an argument. To avoid feature creep in this PR, I have suggested Nico to not implement such extra features in this PR. We could do this separately. (another reason is that when we combine coreneuron together with neuron, may be we should do this altogether differently)

@nrnhines
Copy link
Member

nrnhines commented Apr 22, 2022

not implement such extra features in this PR

That is fine.

@alkino alkino force-pushed the clean_nrnivmodl branch 5 times, most recently from d383b0c to 01d802d Compare April 26, 2022 20:22
@alkino alkino requested review from pramodk and nrnhines April 26, 2022 21:04
bin/nrnivmodl.in Outdated
Comment on lines 165 to 169
if [ $(echo "\n") ] ; then
newline="\n"
else
newline="\\\\n"
fi
Copy link
Member

Choose a reason for hiding this comment

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

I don't recall exactly, but it would have to have been the result of trial and error to get

echo '
void modl_reg(){
  if (!nrn_nobanner_) if (nrnmpi_myid < 1) {
    fprintf(stderr, "Additional mechanisms from files'$newline'");
' >> mod_func.cpp

to emit a valid line fprintf(stderr, "Additional mechanisms from files\n");
I observe on the mac (zsh) that

% echo "\n"

%

though it is correct on the mac with the bash shell.

Copy link
Member

@alexsavulescu alexsavulescu left a comment

Choose a reason for hiding this comment

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

LGTM, very nice cleanup

bin/nrnivmodl.in Show resolved Hide resolved
@alkino
Copy link
Member Author

alkino commented Apr 27, 2022

The problem with echo and newline is that by default some version of echo interpret \ and some doesn't

printf is the way to go to do complicate printing

@alexsavulescu alexsavulescu merged commit 0dda020 into master Apr 28, 2022
@alexsavulescu alexsavulescu deleted the clean_nrnivmodl branch April 28, 2022 07:43
@alexsavulescu alexsavulescu mentioned this pull request Jun 29, 2022
19 tasks
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.

5 participants