Added parallel IO support flags to CMake system. Updated CMake-related documents.

This commit is contained in:
Ward Fisher 2013-02-07 22:16:42 +00:00
parent d9f7b69ae1
commit 4a498ccbb5
10 changed files with 140 additions and 168 deletions

View File

@ -124,8 +124,12 @@ MACRO(print_conf_summary)
MESSAGE(STATUS "\tBuilding NetCDF-4:\t\t" ${ENABLE_NETCDF_4})
MESSAGE(STATUS "\tBuilding DAP Support:\t\t" ${ENABLE_DAP})
MESSAGE(STATUS "\tBuilding Utilities:\t\t" ${BUILD_UTILITIES})
MESSAGE(STATUS "\tCMake Prefix Path:\t\t" ${CMAKE_PREFIX_PATH})
MESSAGE(STATUS "\tLinking against:\t\t" ${ALL_TLL_LIBS})
IF(CMAKE_PREFIX_PATH)
MESSAGE(STATUS "\tCMake Prefix Path:\t\t" ${CMAKE_PREFIX_PATH})
ENDIF()
MESSAGE(STATUS "\tUsing pnetcdf:\t\t\t" ${STATUS_PNETCDF})
MESSAGE(STATUS "\tUsing Parallel IO:\t\t" ${STATUS_PARALLEL})
MESSAGE(STATUS "\tLinking against:\t\t" "${ALL_TLL_LIBS}")
#MESSAGE("CPACK_SOURCE_IGNORE_FILES: ${CPACK_SOURCE_IGNORE_FILES}")
MESSAGE("")
@ -403,11 +407,9 @@ IF(NOT ENABLE_NETCDF_4 AND ENABLE_EXAMPLE_TESTS)
SET (ENABLE_EXAMPLE_TESTS OFF)
ENDIF()
# Options to enable parallel IO, tests.
OPTION(ENABLE_PNETCDF "Build netCDF-4 with parallel I/O for classic and 64-bit offset files using parallel-netcdf." OFF)
IF(ENABLE_PNETCDF)
SET(STATUS_PARALLEL "OFF")
OPTION(ENABLE_PARALLEL "Build netCDF-4 with parallel IO" OFF)
IF(ENABLE_PARALLEL)
SET(USE_PARALLEL ON CACHE BOOL "")
# Check for H5Pget_fapl_mpiposx, define USE_PARALLEL_POSIX
CHECK_FUNCTION_EXISTS(H5Pget_fapl_mpioposix USE_PARALLEL_POSIX)
@ -416,27 +418,36 @@ IF(ENABLE_PNETCDF)
IF(NOT USE_PARALLEL_POSIX)
CHECK_FUNCTION_EXISTS(H5Pget_fapl_mpio USE_PARALLEL_MPIO)
ENDIF()
# Else bail
IF(NOT USE_PARALLEL_POSIX AND NOT USE_PARALLEL_MPIO)
SET(USE_PARALLEL OFF CACHE BOOL "")
MESSAGE("Cannot find HDF5 library built with parallel support. Disabling parallel build.")
ELSE()
# Check for ncmpi_create in libpnetcdf, define USE_PNETCDF
# Does the user want to turn on PNETCDF read ability?
IF(ENABLE_PNETCDF)
FIND_LIBRARY(PNETCDF NAMES pnetcdf)
IF(NOT PNETCDF)
MESSAGE(FATAL_ERROR "Cannot find pnetcdf library, yet pnetcdf support was requested.")
ENDIF()
SET(USE_PNETCDF ON CACHE BOOL "")
ENDIF()
MESSAGE(STATUS "Cannot find HDF5 library built with parallel support. Disabling parallel build.")
ENDIF()
SET(STATUS_PARALLEL "ON")
ENDIF()
OPTION (ENABLE_PARALLEL_TESTS "Enable Parallel IO Tests. Ignored if NetCDF4 is not enabled, or if there is no parallel I/O Support." OFF)
# Options to enable parallel IO, tests.
SET(STATUS_PNETCDF "OFF")
OPTION(ENABLE_PNETCDF "Build netCDF-4 with parallel I/O for classic and 64-bit offset files using parallel-netcdf." OFF)
IF(ENABLE_PNETCDF)
# Check for ncmpi_create in libpnetcdf, define USE_PNETCDF
# Does the user want to turn on PNETCDF read ability?
SET(USE_PNETCDF ON CACHE BOOL "")
FIND_LIBRARY(PNETCDF NAMES pnetcdf)
IF(NOT PNETCDF)
MESSAGE(STATUS "Cannot find pnetcdf library. Disabling pnetcdf support.")
SET(USE_PNETCDF OFF CACHE BOOL "")
ENDIF()
SET(STATUS_PNETCDF "ON")
ENDIF()
OPTION (ENABLE_PARALLEL_TESTS "Enable Parallel IO Tests. Ignored if NetCDF4 is not enabled, or if there is no parallel I/O Support." ${USE_PARALLEL})
IF(ENABLE_PARALLEL_TESTS AND USE_PARALLEL)
SET(TEST_PARALLEL ON CACHE BOOL "")
ENDIF()
OPTION (ENABLE_DOXYGEN "Enable generation of doxygen." OFF)
IF(ENABLE_DOXYGEN)

View File

@ -78,13 +78,15 @@
#cmakedefine USE_PARALLEL_POSIX 1
#cmakedefine USE_PARALLEL_MPIO 1
#cmakedefine USE_PARALLEL 1
#cmakedefine USE_PARALLEL
#cmakedefine USE_PNETCDF 1
#cmakedefine TEST_PARALLEL ${TEST_PARALLEL}
#cmakedefine BUILD_RPC 1
#cmakedefine USE_DISKLESS
#cmakedefine USE_SZIP 1
#cmakedefine USE_ZLIB 1
#cmakedefine USE_X_GETOPT 1
#cmakedefine LARGE_FILE_TESTS 1
#cmakedefine HAVE_CURLOPT_KEYPASSWD
#cmakedefine HAVE_DECL_ISFINITE 1
//#cmakedefine HAVE_DECL_ISNAN 1

View File

@ -0,0 +1,78 @@
\page netCDF-CMake Build Instructions for netCDF-C using CMake
# Overview
Starting with netCDF-C 4.3, we are happy to announce the inclusion of CMake support. CMake will allow for building netCDF on a wider range of platforms, include Microsoft Windows with Visual Studio. CMake support also provides robust unit and regression testing tools. We will also maintain the standard autotools-based build system in parallel.
In addition to providing new build options for netCDF-C, we will also provide pre-built binary downloads for the shared versions of netCDF for use with Visual Studio.
# Requirements
The following packages are required to build netCDF-C using CMake.
* netCDF-C Source Code
* CMake version 2.9+
* Optional Requirements:
* HDF5 Libraries for netCDF4/HDF5 support.
* libcurl for DAP support.
<center>
<img src="../images/deptree.jpg" height="250px" />
</center>
# The CMake Build Process
There are four steps in the Build Process when using CMake
1. Configuration: Before compiling, the software is configured based on the desired options.
2. Building: Once configuration is complete, the libraries are compiled.
3. Testing: Post-build, it is possible to run tests to ensure the functionality of the netCDF-C libraries.
4. Installation: If all tests pass, the libraries can be installed in the location specified during configuration.
## Configuration
The output of the configuration step is a project file based on the appropriate configurator specified. Common configurators include:
* Unix Makefiles
* Visual Studio
* CodeBlocks
* ... and others
### Common CMake Options
| **Option** | **Autotools** | **CMake** |
| :------- | :----: | :-----: |
Specify Install Location | --prefix=PREFIX | -D"CMAKE\_INSTALL\_PREFIX=PREFIX"
Enable/Disable netCDF-4 | --enable-netcdf-4<br>--disable-netcdf-4 | -D"ENABLE\_NETCDF\_4=ON" <br> -D"ENABLE\_NETCDF\_4=OFF"
Enable/Disable DAP | --enable-dap <br> --disable-dap | -D"ENABLE\_DAP=ON" <br> -D"ENABLE\_DAP=OFF"
Enable/Disable Utilities | --enable-utilities <br> --disable-utilities | -D"BUILD\_UTILITIES=ON" <br> -D"BUILD\_UTILITIES=OFF"
Specify shared/Static Libraries | --enable-shared <br> --enable-static | -D"BUILD\_SHARED\_LIBS=ON" <br> -D"BUILD\_SHARED\_LIBS=OFF"
Enable/Disable Tests | --enable-testsets <br> --disable-testsets | -D"ENABLE\_TESTS=ON" <br> -D"ENABLE\_TESTS=OFF"
## Building
The compiler can be executed directly with 'make' or the appropriate command for the configurator which was used.
> \> make
Building can also be executed indirectly via cmake:
> \> cmake --build [Build Directory]
## Testing
Testing can be executed several different ways:
> \> make test
or
> \> ctest
or
> \> cmake --build [Build Directory] --target test
## Installation
Once netCDF has been built and tested, it may be installed using the following commands:
> \> make install
or
> \> cmake --build [Build Directory] --target install

View File

@ -655,7 +655,8 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = @CMAKE_SOURCE_DIR@/man4/mainpage.doc \
INPUT = @CMAKE_SOURCE_DIR@/man4/Building-with-CMake.md \
@CMAKE_SOURCE_DIR@/man4/mainpage.doc \
@CMAKE_SOURCE_DIR@/man4/tutorial.doc \
@CMAKE_SOURCE_DIR@/man4/install.doc \
@CMAKE_SOURCE_DIR@/man4/dispatch.doc \
@ -665,7 +666,6 @@ INPUT = @CMAKE_SOURCE_DIR@/man4/mainpage.doc \
@CMAKE_SOURCE_DIR@/man4/cdl.doc \
@CMAKE_SOURCE_DIR@/man4/architecture.doc \
@CMAKE_SOURCE_DIR@/man4/internal.doc \
@CMAKE_SOURCE_DIR@/man4/win_netcdf.doc \
@CMAKE_SOURCE_DIR@/COPYRIGHT \
@CMAKE_SOURCE_DIR@/include/netcdf.h \
@CMAKE_SOURCE_DIR@/examples/C/simple_xy_wr.c \
@ -705,7 +705,7 @@ INPUT = @CMAKE_SOURCE_DIR@/man4/mainpage.doc \
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
# also the default input encoding. Doxygen uses libiconv (or the iconv built
# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
# the list of possible encodings.
# the list of possible encodings.# Build Instructions for netCDF-C using CMake
INPUT_ENCODING = UTF-8
@ -789,7 +789,8 @@ IMAGE_PATH = @CMAKE_SOURCE_DIR@/man4/images/chunking2.png \
@CMAKE_SOURCE_DIR@/man4/images/nccoords.png \
@CMAKE_SOURCE_DIR@/man4/images/ncfile.png \
@CMAKE_SOURCE_DIR@/man4/images/netcdf_architecture.png \
@CMAKE_SOURCE_DIR@/man4/images/pnetcdf.png
@CMAKE_SOURCE_DIR@/man4/images/pnetcdf.png \
@CMAKE_SOURCE_DIR@/man4/images/deptree.jpg
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
man4/images/deptree.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -47,7 +47,7 @@ full functionality. (See \ref architecture).
- \ref build_classic
- \ref build_hdf4
- \ref build_parallel
- \ref build_windows
- \ref netCDF-CMake
- \ref configure_options
\page build_default Building with NetCDF-4 and the Remote Data Client
@ -247,12 +247,6 @@ netCDF-4 libraries:
cc -o myapp myapp.c `nc-config --cflags --libs`
\endverbatim
\page build_windows Building with Windows
See the <a href="http://www.unidata.ucar.edu/netcdf/win_netcdf/"
>NetCDF for Windows </a> page for Current information about building
netCDF on Windows or downloading prebuilt Windows binaries.
\page configure_options ./configure options
Note: --disable prefix indicates that the option is normally enabled.

View File

@ -19,7 +19,6 @@ Hartnett, Dennis Heimbigner and Ward Fisher
<p>Learn more about netCDF:
- \ref getting
- \ref building
- \ref windows
- \ref tutorial
- \ref user_guide
- <A HREF="http://www.unidata.ucar.edu/software/netcdf/docs/index-413.html">Documentation for 4.1.3 (in previous form)</A>

View File

@ -1,133 +0,0 @@
/** \file
Instructions for building NetCDF on Windows.
\page windows NetCDF on Windows
<A NAME="win_netcdf" ID="win_netcdf"></A>
<h1>NetCDF for Windows (Current Release: 4.2.1.1)</h1>
<ul>
<li><A HREF="#overview">Overview</A></li>
<li><A HREF="#binaries">Windows NetCDF Binaries</A></li>
<li><A HREF="#compiling">Compiling Windows NetCDF from source for Windows</A></li>
<li><A HREF="#compnotes">Compilation Notes & Gotchas</A></li>
</ul>
</p>
<h2><A name="Overview"></A>Overview</h2>
</p>
Starting with the NetCDF 4.2.1 release, we are happy to provide official Windows and Visual Studio support. Please note that while our goal is full functionality, there will undoubtedly be a number of fixes required as the Windows version begins to see wider adoption. We provide binary downloads for shared and static Windows libraries, as well as instructions for compiling libraries using the MSYS/MinGW environment.</p>
The current NetCDF build for Windows supports NetCDF Classic, NetCDF-4, HDF5, DAP and Diskless functionality.</p>
Currently, Visual-Studio based builds are not supported, but CMake support is being actively developed. Cygwin builds are also supported; for Cygwin environments, follow the MSYS/MinGW instrunctions.
</p>
<h1>Getting NetCDF Libraries for Windows</h1>
These libraries can be used with Visual Studio projects. The libraries themselves were tested with Visual Studio 2010. These downloads contain the libraries, the dependent libraries which they were built against, the netcdf utilities (ncgen, ncdump). <br>
<h2 style="font-size: larger;"><A name="binaries"></A>Windows NetCDF 4.2.1.1 Binaries</h2>
<ul>
<li>Windows libraries (shared and static):</li>
<table cellpadding=5 border="1">
<tr>
<td></td>
<th>32-bit libraries</th>
<th>64-bit libraries</th>
</tr>
<tr>
<td colspan=3><center>Static (.a, .lib) Libraries</center></td>
</tr>
<tr>
<td>NetCDF 2/3 Only, No DAP</td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc3_32_static.zip">nc3_32_static.zip</A></td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc3_64_static.zip">nc3_64_static.zip</A></td>
</tr>
<tr>
<td>NetCDF-4, HDF5, No DAP</td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc4_32_static.zip">nc4_32_static.zip</A></td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc4_64_static.zip">nc4_64_static.zip</A></td>
</tr>
<tr>
<td>NetCDF-4, HDF5, DAP</td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc4_dap_32_static.zip">nc4_dap_32_static.zip</A></td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc4_dap_64_static.zip">nc4_dap_64_static.zip</A></td>
</tr>
<tr>
<td colspan=3><center>Dynamic (.dll) Libraries</center></td>
</tr>
<tr>
<td>NetCDF 2/3 Only, No DAP</td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc3_32_dll.zip">nc3_32_dll.zip</A></td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc3_64_dll.zip">nc3_64_dll.zip</A></td>
</tr>
<tr>
<td>NetCDF-4, HDF5, No DAP</td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc4_32_dll.zip">nc4_32_dll.zip</A></td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc4_64_dll.zip">nc4_64_dll.zip</A></td>
</tr>
<tr>
<td>NetCDF-4, HDF5, DAP</td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc4_dap_32_dll.zip">nc4_dap_32_dll.zip</A></td>
<td><A HREF="http://www.unidata.ucar.edu/netcdf/win_netcdf/nc4_dap_64_dll.zip">nc4_dap_64_dll.zip</A></td>
</tr>
</table>
</ul>
<h3 style="font-size: larger;"><A name="compiling"></A>Compiling Windows NetCDF 4.2.1.1 from Source</h3>
<ol>
<li>Install the latest MSYS/MinGW environment for your Windows machine:</li>
<ul>
<li><A HREF=http://www.mingw.org/wiki/MSYS>http://www.mingw.org/wiki/MSYS</A></li>
<i>Note: Configuring a 64-bit MinGW environment is non-trivial. Consider one of our binary downloads instead.</i>
</ul>
<li><A HREF="http://www.unidata.ucar.edu/downloads/netcdf">Download the latest NetCDF source code (4.2.1.1).</A></li>
<li>Install the NetCDF dependencies (as needed):</li>
<i>These libraries are optional, and are only required if you want the functionality they provide.</i>
<ul>
<li>HDF5 & SZip: <A HREF="http://www.hdfgroup.org/HDF5/release/obtain5.html">http://www.hdfgroup.org/HDF5/release/obtain5.html</A></li>
<li>ZLib:
<ul>
<li>Source: <A HREF="http://zlib.net/">http://zlib.net/</A></li>
<li>Official Windows Library binaries: <A HREF="http://www.winimage.com/zLibDll/index.html">http://www.winimage.com/zLibDll/index.html</A></li>
</ul>
<li>libcurl: <A HREF="http://curl.haxx.se/download.html">http://curl.haxx.se/download.html</A></li>
</ul>
<li>Configure & Build NetCDF:</li>
<ul>
<li>'./configure --[desired options] \ <br> CFLAGS="-fno-stack-check -fno-stack-protector -mno-stack-arg-probe -I[path to dependency include files] " \ <br>LDFLAGS="-L[path to dependency library files]"'</li>
<I>Note that the first 3 'CFLAGS' arguments are used to prevent 'unresolved external symbol' errors when using the resulting libnetcdf with Visual Studio.</I>
<li>'make'</li>
<li>'make check'</li>
</ul>
<li>The final libraries are located in [NetCDF Root]/liblib/.libs</li>
<i>Note: To use static libraries in Visual Studio, you may rename the .a files as .lib files. For Visual Studio 2010 (and possibly previous versions), this is not strictly necessary.</i>
</ol>
<h1><A name="CompNotes"></A>Compilation Notes and Gotchas</h1>
Building Visual Studio compatible NetCDF under Windows is a fairly complex process. We will eventually mitigate this complexity by integrating CMake-based builds into NetCDF. For the time being, we recommend you download our <A HREF="#binaries">binary</A> packages. If, for whatever reason, these binaries will not work for you, please be aware of the following when building NetCDF for Windows:</p>
<ul>
<li>Two versions of any dependency libraries may be required:</li>
<ul>
<li>MSYS/MinGW compatible version, linked against at libnetcdf compile time.</li>
<I>These are not necessary if using the libraries downloaded above.</I>
<li>Visual Studio compatible version, used at compile/runtime for your Visual Studio project.</li>
</ul>
<li>As outlined above, you must use the following CFLAGS when configuring NetCDF:</li>
<ul>
<li>-fno-stack-check</li>
<li>-fno-stack-protector</li>
<li>-mno-stack-arg-probe</li>
</ul>
</ul>
*/

View File

@ -15,10 +15,30 @@ IF(NOT MSVC)
SET(NC4_TESTS ${NC4_TESTS} tst_interops5 tst_camrun)
ENDIF()
IF(LARGE_FILE_TESTS)
SET(NC4_TESTS ${NC4_TESTS} tst_large tst_large2)
ENDIF()
IF(USE_HDF4)
SET(NC4_TESTS ${NC4_TESTS} tst_interops2)
ENDIF()
IF(BUILD_BENCHMARKS)
add_sh_test(nc_test4 run_bm_test1)
add_sh_test(nc_test4 run_bm_elena)
add_sh_test(nc_test4 run_bm_test2)
add_sh_test(nc_test4 run_tst_chunks)
add_sh_test(nc_test4 run_bm_ar4)
add_sh_test(nc_test4 run_get_knmi_files)
SET(NC4_TESTS ${NC4_TESTS} tst_create_files bm_file tst_chunks3 tst_ar4 tst_ar4_3d tst_ar4_4d bm_many_objs tst_h_many_atts bm_many_atts tst_files2 tst_files3 tst_ar5 tst_h_files3 tst_mem tst_knmi bm_netcdf4_recs)
IF(TEST_PARALLEL)
add_sh_test(nc_test4 run_par_bm_test)
ENDIF()
ENDIF()