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

README clarification + fix typo #69

Merged
merged 3 commits into from
Oct 29, 2023
Merged

Conversation

mrogowski
Copy link
Contributor

No description provided.

@mrogowski mrogowski changed the title Fix typo Fix typo + clarification Oct 23, 2023
@mrogowski
Copy link
Contributor Author

@IshaanDesai, re: openjournals/joss-reviews#5842

I tried to follow the steps from the README.md: running python macro_dummy.py in one terminal and python python-dummy/run_micro_manager.py in the other. It failed:

  File "/root/.local/lib/python3.10/site-packages/micro_manager/micro_manager.py", line 65, in __init__
    self._config = Config(self._logger, config_file)
  File "/root/.local/lib/python3.10/site-packages/micro_manager/config.py", line 49, in __init__
    self.read_json(config_filename)
  File "/root/.local/lib/python3.10/site-packages/micro_manager/config.py", line 60, in read_json
    folder = os.path.dirname(os.path.join(os.getcwd(), config_filename))
  File "/usr/lib/python3.10/posixpath.py", line 90, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.10/genericpath.py", line 152, in _check_arg_types
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

I think the config parameter is missing: python python-dummy/run_micro_manager.py --config micro-manager-adaptivity-config.json worked. Can you please clarify/fix the README if needed?

@mrogowski
Copy link
Contributor Author

mrogowski commented Oct 23, 2023

Same comment on the "Run the Micro Manager" page. It seems that --config is missing:
mpirun -n <number-of-procs> python3 run-micro-manager.py.

Once I run with config and more than 1 rank, I get:

mpiexec -n 2 python3 python-dummy/run_micro_manager.py --config micro-manager-config.json
(1) 08:02:20 [com::Communication]:35 in connectIntraComm: Connecting Secondary rank #0 to Primary rank
Traceback (most recent call last):
  File "/home/mm/micro-manager/examples/python-dummy/run_micro_manager.py", line 14, in <module>
    manager.initialize()
  File "/root/.local/lib/python3.10/site-packages/micro_manager/micro_manager.py", line 143, in initialize
    coupling_mesh_bounds = domain_decomposer.decompose_macro_domain(self._macro_bounds, self._ranks_per_axis)
  File "/root/.local/lib/python3.10/site-packages/micro_manager/domain_decomposition.py", line 50, in decompose_macro_domain
    assert np.prod(
AssertionError: Total number of processors provided in the Micro Manager configuration and in the MPI execution command do not match.

@mrogowski
Copy link
Contributor Author

I tried to add "decomposition": [ 2, 2 ] to micro-manager-config.json, and now I am getting:

  File "/root/.local/lib/python3.10/site-packages/micro_manager/micro_manager.py", line 143, in initialize
    manager.initialize()
  File "/root/.local/lib/python3.10/site-packages/micro_manager/micro_manager.py", line 143, in initialize
    coupling_mesh_bounds = domain_decomposer.decompose_macro_domain(self._macro_bounds, self._ranks_per_axis)
  File "/root/.local/lib/python3.10/site-packages/micro_manager/domain_decomposition.py", line 55, in decompose_macro_domain
    coupling_mesh_bounds = domain_decomposer.decompose_macro_domain(self._macro_bounds, self._ranks_per_axis)
  File "/root/.local/lib/python3.10/site-packages/micro_manager/domain_decomposition.py", line 55, in decompose_macro_domain
    dx.append(abs(macro_bounds[d * 2 + 1] - macro_bounds[d * 2]) / ranks_per_axis[d])
IndexError: list index out of range
    dx.append(abs(macro_bounds[d * 2 + 1] - macro_bounds[d * 2]) / ranks_per_axis[d])
IndexError: list index out of range

@mrogowski mrogowski changed the title Fix typo + clarification README clarification + fix typo Oct 23, 2023
@IshaanDesai
Copy link
Member

Hi @mrogowski

Thanks for your feedback! I have added the --config parameter to the examples/README. The run-micro-manager.py is a script that the user usually writes, so it is not provided with the Micro Manager. Hence I write the generic way of mpirun -n <number-of-procs> run-micro-manager.py in the main documentation.

Where did you add the "decomposition": [2, 2]? The example problem is 3D, so the decomposition list needs 3 elements, for example, [2, 2, 1]. But I see now that the error message is cryptic, I will improve it.

@mrogowski
Copy link
Contributor Author

Thanks for the response. I got it working now.

I also had issues with macro_domain_bounds and decomposition. The example from the documentation:

"simulation_params": {
    "macro_domain_bounds": [0, 1, 0, 1, 0, 1],
    "decomposition": [2, 1, 16]
}

did not work for me when running with 32 processes. Cases such as

"simulation_params": {
    "macro_domain_bounds": [0, 24, 0, 24, 0, 25],
    "decomposition": [2, 2, 1]
}

where the integer size of the domain is divisible by the number of processes seem to work. Is it a known issue, or have I missed something?

@IshaanDesai
Copy link
Member

did not work for me when running with 32 processes.

The domain decomposition is not very robust, but this should work in my opinion. What error did you get?

@mrogowski
Copy link
Contributor Author

"simulation_params": {
    "macro_domain_bounds": [0, 1, 0, 1, 0, 1],
    "decomposition": [2, 1, 16]
}

results in

Traceback (most recent call last):
  File "/micro-manager/examples/python-dummy/run_micro_manager.py", line 14, in <module>
    manager.initialize()
  File "/root/.local/lib/python3.10/site-packages/micro_manager/micro_manager.py", line 257, in initialize
    self._global_ids_of_local_sims[0], self._global_ids_of_local_sims[-1]))
IndexError: list index out of range

@IshaanDesai
Copy link
Member

I investigated the problem further, and the error is hit because there are not enough vertices in the axis of the highest number of partitions. The unit cube example has 5 vertices in each axis, so when the number of partitions in the Z axis is set to 16, 11 ranks have no vertices. The Micro Manager v0.3.0 cannot handle empty ranks. I will add an error message here.

@IshaanDesai
Copy link
Member

@mrogowski now the "decomposition": [2, 1, 16] case should be caught by a proper assertion, which tells you what the problem is. If you agree, I will finalize and merge this PR.

@mrogowski
Copy link
Contributor Author

Looks good!

I tried to increase nv in macro_dummy.py to see if it will fix the problem, but no luck yet. I think the critical warning message is:

(0) 09:00:30 [partition::ReceivedPartition]:871 in createOwnerInformation: WARNING: 65519 of 65536 vertices of mesh macro-mesh have been filtered out since they have no influence on the mapping. Associated data values of the filtered vertices will be filled with zero values in order to provide valid data for other participants when reading data.

and it results in the same error:

  File "/usr/local/lib/python3.10/dist-packages/micro_manager/micro_manager.py", line 258, in initialize
    self._global_ids_of_local_sims[0], self._global_ids_of_local_sims[-1]))

Do I need to change any other variables to make it work? I am still using v0.3.0.

@IshaanDesai
Copy link
Member

IshaanDesai commented Oct 29, 2023

I am making the changes on your patch-4 branch, because v0.3.0 is now released and can no longer be changed. You can just pull your branch, compile, and run the tests again. You would need to compile the develop branch of preCICE though, because the develop branch of the Micro Manager is in a state that works with the develop branch of preCICE.

@mrogowski
Copy link
Contributor Author

I understand and I was not expecting the new error message. What I was trying to do is to increase the number of vertices in macro_dummy.py, expecting things to work now. Did I miss something?

@IshaanDesai
Copy link
Member

I understand and I was not expecting the new error message. What I was trying to do is to increase the number of vertices in macro_dummy.py, expecting things to work now. Did I miss something?

Okay, I understand now. The vertices in macro_dummy.py are constructed in a rather rudimentary way, and do not form a cube or any particular shape. They are structured as (0, 0, 0), (1, 1, 1), (2, 2, 2), .... This is not ideal to test the domain decomposition functionality of the Micro Manager, because if a domain is cut in more than one axis, at least one partition would end up without any vertices. A decomposition of the type of [1, 1, 16] would however work. You have to additional change the macro_domain_bounds from [0.0, 25.0, 0.0, 25.0, 0.0, 25.0], in a way that the maximum value in each axis is equal to the number of vertices you are now setting.

@mrogowski
Copy link
Contributor Author

Great, it is working now. I have no further questions, only a suggestion to perhaps - at some point - update the documentation with a multiprocess example.

Thanks for all the clarifications!

@IshaanDesai
Copy link
Member

Great, it is working now. I have no further questions, only a suggestion to perhaps - at some point - update the documentation with a multiprocess example.

Thank you for this discussion! I will open an issue regarding adding documentation with a multi-process example.

@IshaanDesai IshaanDesai merged commit f45efbd into precice:develop Oct 29, 2023
9 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.

2 participants