Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Remove numprocs=x print #1255

Closed
Helveg opened this issue May 5, 2021 · 6 comments
Closed

Remove numprocs=x print #1255

Helveg opened this issue May 5, 2021 · 6 comments

Comments

@Helveg
Copy link
Contributor

Helveg commented May 5, 2021

Overview of the feature

NEURON under MPI prints an initial numprocs=n that can not be turned off and can not be silenced by capturing stdout from Python. It uses printf but is called at a point in time where Printf is not available yet. Remedying all these things would require considerable efforts. I propose to simply remove the print.

Issues with the amount of MPI processes can be diagnosed in alternative ways:

  • The same number can be obtained using h.ParallelContext().nhost()
  • Using mpi4py

Foreseeable Impact

People wouldn't accidentally stumble upon an error with their number of MPI processes when they accidentally fumble and make an error with their number of MPI processes.

  • Area(s) of change: 1 line of code
  • Possible issues: None
  • External dependencies such as new libraries: None
@pramodk
Copy link
Member

pramodk commented May 5, 2021

Remove numprocs=x print #1255

Without understanding technical details of the problem, I would say this printf message has been quite useful for users to find out simple mistakes in job scripts where things are running with wrong number of processes or serially (agree that I am trying to be naive user here 😃 ). You can see that I jumped here quickly because while debugging many models, have looked at this message myself 😃 .

About the Printf technicalities, I will let Michael to comment here.

@nrnhines
Copy link
Member

nrnhines commented May 5, 2021

I'd like to leave it in for nrniv. But for python, I've moved to the side of quieter is better. It may be that people will become familiar with

if (pc.id() == 0): print("nhost=", pc.nhost())

@ramcdougal
Copy link
Member

Is there a global or something that knows if we're running from Python?

Also, does running via nrniv -python count as via Python or via nrniv?

@nrnhines
Copy link
Member

nrnhines commented May 5, 2021

nrniv generates a banner unless launched with --nobanner. We've turned off the banner when python is launched and import neuron is executed. We've also turned off the occasionally helpful (when things go wrong) line listing the dynamically loaded mechanisms.

There is a global that knows if python is launched and extended with NEURON vs nrniv is launched and embedded python called extern int nrn_is_python_extension;.

My feeling is that nrniv -python counts as nrniv.

@ramcdougal
Copy link
Member

How about this?

We make it so it prints the numprocs line only when nrn_nobanner_ is 0?

The relevant change would be confined to

if (nrnmpi_myid == 0) {

@nrnhines
Copy link
Member

nrnhines commented May 5, 2021

I like that. The problem is that when nrniv is launched the code in nrnmpi.cpp is executed before ivoc_main(...) where the args are read. Turns out it is easier (I think) to just not print if python was launched by interrogating nrn_is_python_extension.
Since args are also passed to nrnmpi.cpp, I guess I could check for the --nobanner as well (so that would turn it off for nrniv).

@neuronsimulator neuronsimulator locked and limited conversation to collaborators Jan 17, 2023
@alexsavulescu alexsavulescu converted this issue into discussion #2169 Jan 17, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

4 participants