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

parallel netcdf4 #9

Open
apatlpo opened this issue Jan 26, 2018 · 30 comments
Open

parallel netcdf4 #9

apatlpo opened this issue Jan 26, 2018 · 30 comments

Comments

@apatlpo
Copy link
Contributor

apatlpo commented Jan 26, 2018

It'd be great to write netcdf output files.
This is the standard for many users in the geophysical community.
Parallel file writing is implemented in netCDF4.
I failed to install it via conda however.
Could it be possible to have it in the spectralDNS channel as it is the case for hdf5-parallel?

@mikaem
Copy link
Member

mikaem commented Jan 26, 2018

Hi
I have not used netcdf4, but I would not object to someone adding support for it. I see that netcdf4 is available on conda-forge, but this is only serial version of the library. And there's a libnetcdf. Are both required? Should probably only be an issue of using these recipes with hdf5-parallel instead of the serial versions used on conda-forge I think.

@mikaem
Copy link
Member

mikaem commented Jan 26, 2018

It built quite easily on Ubuntu, so I put two versions, libnetcdf-parallel and netcdf4-parallel on Anaconda cloud. Feel free to check them out. The last one was built with python=3.6. Let me know if you need anything else.

@apatlpo
Copy link
Contributor Author

apatlpo commented Jan 26, 2018

That's great, thanks, but today I'm on osx unfortunately.
Would you be able at some point to add an osx version of these libraries?

@mikaem
Copy link
Member

mikaem commented Jan 26, 2018

I'll see what I can do.

@mikaem
Copy link
Member

mikaem commented Jan 31, 2018

@apatlpo I have now uploaded netcdf built for osx to the spectralDNS channel.

@apatlpo
Copy link
Contributor Author

apatlpo commented Jan 31, 2018

Thanks it works like a charm for me !
Starting from the hdf5 file writer, I wrote a netcdf file writer.
It works well for a simple configuration.
Let me know if you want me to push a pull request to shenfun of this file.

@mikaem
Copy link
Member

mikaem commented Jan 31, 2018

Great:-) Go ahead with the pull request. Perhaps you can even improve it? I have spent way too little time on the IO-interface.

@apatlpo
Copy link
Contributor Author

apatlpo commented Jan 31, 2018

ok, will proceed with the PR ( beware this will be my first :) ).

As far as improvements, I don't have time to do it right now but here is a to do list for the future:

  • Add testing
  • Add slicing capability
  • Optional names for coordinates
  • Optional number of time steps per file

@apatlpo
Copy link
Contributor Author

apatlpo commented May 25, 2018

I just reinstalled shenfun via:

conda build -c conda-forge -c spectralDNS conf/conda
conda install -c conda-forge -c spectralDNS shenfun --use-local

This does not install netCDF4 which raises the following warning at imports:

>>> import shenfun
/Users/aponte/.miniconda3/envs/shenfun/lib/python3.6/site-packages/shenfun/utilities/nc_writer.py:11: UserWarning: netcdf not installed
  warnings.warn('netcdf not installed')

Is this intended?

As a side note, it may be nice to suggest the creation of a shenfun conda environment prior to running
these last install lines in the doc.

@mikaem
Copy link
Member

mikaem commented May 25, 2018

Not intended at all. I see that netcdf is not added to meta.yaml. Do you remember what the requirements were?

And you are correct about the last note. I'll update the readme.

@mikaem
Copy link
Member

mikaem commented May 25, 2018

I think it should be netcdf4-parallel and libnetcdf-parallel, right?

@mikaem
Copy link
Member

mikaem commented May 25, 2018

And there should be some tests on the netcdf io...

@mikaem
Copy link
Member

mikaem commented May 25, 2018

Latest package from Anaconda cloud should now also include netcdf.

@apatlpo
Copy link
Contributor Author

apatlpo commented May 28, 2018

Great thanks.

Regarding tests, should I just propose additions to 'test/test_io.py' ?

@mikaem
Copy link
Member

mikaem commented May 28, 2018

Yes, that would be great.

I have written a little bit about post-processing in the documentation. Have not written much about netcdf and one reason for this is that it does not have the option to store slices. Are you not interested in this feature?

@apatlpo
Copy link
Contributor Author

apatlpo commented Jun 8, 2018

just letting you know I am not dropping this.

I am fighting a ModuleNotFoundError: No module named 'mpi4py_fft at the moment.

@mikaem
Copy link
Member

mikaem commented Jun 8, 2018

That means you haven't installed the mpi4py-fft package. Should be automatically installed if you used conda...

@apatlpo
Copy link
Contributor Author

apatlpo commented Jun 8, 2018

Yes, I am using conda.
I have restarted from scratch the environment.
I don't understand what is going on.

@apatlpo
Copy link
Contributor Author

apatlpo commented Jun 8, 2018

Where is the mpi4py-fft dependency explicited in the library?

@apatlpo
Copy link
Contributor Author

apatlpo commented Jun 8, 2018

Shouldn't it be added to conf/conda/meta.yaml?

@mikaem
Copy link
Member

mikaem commented Jun 8, 2018

It's in the components-requirements file

@mikaem
Copy link
Member

mikaem commented Jun 8, 2018

No. It is only available as source for now. There's no package available anywhere so meta.yaml won't work.

@apatlpo
Copy link
Contributor Author

apatlpo commented Jun 8, 2018

nevermind, I got confused because it is not showing up with conda list.
shenfun is up and running.
sorry for the noise

@mikaem
Copy link
Member

mikaem commented Jun 8, 2018

puh:-)

@mikaem
Copy link
Member

mikaem commented Jun 8, 2018

But you should be able to install it from the spectralDNS channel, right? I forgot it was there as well.

@apatlpo
Copy link
Contributor Author

apatlpo commented Jun 8, 2018

I followed:

conda build -c conda-forge -c spectralDNS conf/conda
conda create --name shenfun -c conda-forge -c spectralDNS shenfun --use-local
conda activate shenfun

I've added netcdf tests in test_io.py but am at a loss as to what is the best way to check if test
are passing.
What would you do ?

@apatlpo
Copy link
Contributor Author

apatlpo commented Jun 8, 2018

A How to contribute section on the doc could be useful ...

@mikaem
Copy link
Member

mikaem commented Jun 8, 2018

I don't follow. You mean what is the best way to call the test itself? like py.test -v test_io.py?

@apatlpo
Copy link
Contributor Author

apatlpo commented Jun 8, 2018

yep, sorry I have never done this before ...
(note for myself, this was required: pip install -U pytest)

Tests seem to pass. I'll send a PR soon.

Regarding slices, I am indeed interested in that and do not see any particular reasons for why one could not slice with netcdf.

@mikaem
Copy link
Member

mikaem commented Jun 8, 2018

Ah, now I see. The py.test you were running before was not in the current environment and therefore no mpi4py_fft! I have made that same error a few times:-)

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

2 participants