Weiming-Hu / AnalogsEnsemble

The C++ and R packages for parallel ensemble forecasts using Analog Ensemble
https://weiming-hu.github.io/AnalogsEnsemble/
MIT License
18 stars 5 forks source link

Multi-threaded read of NetCDF files #38

Closed Weiming-Hu closed 5 years ago

Weiming-Hu commented 5 years ago

This has been resolved in commit 8fe1dc12cca4cc6321c7272b6a15eac481d1e234.

However, an important note here. The multi-thread reading of NetCDF files is actually not in parallel. Since netCDF C API is not thread-safe, function calls to the library to read from files are serialized using pragma omp critical. Otherwise, function calls from different threads will cause assertion failures.

I still keep this implementation and it is tested with the hope that in the near future netCDF library will provide thread-safe APIs natively.