added missing file, fixed includes, removed unneeded header file

This commit is contained in:
Ed Hartnett 2010-10-08 20:08:24 +00:00
parent 65c54d88f5
commit 64d614fd87
12 changed files with 96 additions and 77 deletions

View File

@ -29,6 +29,11 @@ int total_err = 0, err = 0;
char *format_name[] = {"", "classic", "64-bit offset", "netCDF-4",
"netCDF-4 classic model"};
#define BAIL(e) do { \
printf ("Bailing out in file %s, line %d, error:%s.\n", __FILE__, __LINE__, nc_strerror(e)); \
return -1; \
} while (0)
/* This macro prints an error message with line number and name of
* test program. */
#define ERR do { \

View File

@ -7,7 +7,7 @@
$Id: cdm_sea_soundings.c,v 1.5 2010/05/25 13:53:04 ed Exp $
*/
#include <tests.h>
#include <nc_tests.h>
#define FILE_NAME "cdm_sea_soundings.nc"
#define DIM_NAME "Sounding"

View File

@ -1,66 +0,0 @@
/* This is part of the netCDF package.
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
Common includes, defines, etc., for test code in the nc_test4
directory.
$Id: tests.h,v 1.6 2010/05/25 13:53:04 ed Exp $
*/
#ifndef _NC_TEST4_TESTS_
#define _NC_TEST4_TESTS_
#include <config.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef USE_PARALLEL
#include <netcdf_par.h>
#include <mpi.h>
#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
#include <mpio.h>
#endif
#endif
#include <netcdf.h>
int total_err = 0, err = 0;
/* This is handy for print statements. */
char *format_name[] = {"", "classic", "64-bit offset", "netCDF-4", "netCDF-4 strict NC3"};
#define BAIL(e) do { \
printf ("Bailing out in file %s, line %d, error:%s.\n", __FILE__, __LINE__, nc_strerror(e)); \
return -1; \
} while (0)
#define ERR do { \
fflush(stdout); /* Make sure our stdout is synced with stderr. */ \
err++; \
fprintf(stderr, "unexpected result, %s, line: %d\n", __FILE__, __LINE__); \
} while (0)
#define SUMMARIZE_ERR do { \
if (err) \
{ \
printf("%d failures\n", err); \
total_err += err; \
err = 0; \
} \
else \
printf("ok.\n"); \
} while (0)
/* Print out our number of errors, if any, and exit badly. */
#define FINAL_RESULTS do { \
if (total_err) \
{ \
printf("%d errors detected! Sorry!\n", total_err); \
return 2; \
} \
printf("*** Tests successful!\n"); \
return 0; \
} while (0)
#endif /* _NC_TEST4_TESTS_ */

View File

@ -7,7 +7,7 @@
$Id: tst_mpi_parallel.c,v 1.2 2009/08/19 15:58:57 ed Exp $
*/
#include "tests.h"
#include <nc_tests.h>
#include <mpi.h>
#define FILE "tst_mpi_parallel.bin"

View File

@ -9,7 +9,7 @@ Dennis Nadeau.
$Id: tst_nc4perf.c,v 1.4 2009/08/19 15:58:57 ed Exp $
*/
#include "tests.h"
#include "nc_tests.h"
#define FILENAME "tst_nc4perf.nc"
#define NDIMS1 2

View File

@ -13,7 +13,7 @@ $Id: tst_parallel.c,v 1.7 2009/08/19 15:58:57 ed Exp $
* clog2TOslog2) and then used in the analysis program jumpshot. */
/*#define USE_MPE 1*/
#include "tests.h"
#include <nc_tests.h>
#include <mpi.h>
#ifdef USE_MPE
#include <mpe.h>

View File

@ -9,7 +9,7 @@
* clog2TOslog2) and then used in the analysis program jumpshot. */
/*#define USE_MPE 1*/
#include "tests.h"
#include <nc_tests.h>
#include <mpi.h>
#include <pnetcdf.h>

View File

@ -18,7 +18,7 @@
*
*/
#include "tests.h"
#include <nc_tests.h>
#define FILE_NAME "tst_parallel3.nc"

View File

@ -9,7 +9,7 @@
* clog2TOslog2) and then used in the analysis program jumpshot. */
/*#define USE_MPE 1*/
#include "tests.h"
#include <nc_tests.h>
#include <mpi.h>
#ifdef USE_MPE
#include <mpe.h>

View File

@ -149,13 +149,12 @@ endif #BUILD_BENCHMARKS
# Test parallel I/O.
if TEST_PARALLEL
check_PROGRAMS += f90tst_parallel f90tst_parallel2 f90tst_parallel3 \
f90tst_nc4_par f90tst_nc4_par1
f90tst_nc4_par
#f90tst_parallel_fill
f90tst_parallel_SOURCES = f90tst_parallel.f90
f90tst_parallel2_SOURCES = f90tst_parallel2.f90
f90tst_parallel3_SOURCES = f90tst_parallel3.f90
f90tst_nc4_par_SOURCES = f90tst_nc4_par.f90
f90tst_nc4_par1_SOURCES = f90tst_nc4_par1.f90
#f90tst_parallel_fill_SOURCES = f90tst_parallel_fill.f90
TESTS += run_f90_par_test.sh
CLEANFILES += f90tst_parallel*.nc

View File

@ -0,0 +1,82 @@
! This parallel test was contributed by Jim Edwards at UCAR. Thanks Jim!
program f90tst_nc4_par
use netcdf
use mpi
implicit none
character (len = *), parameter :: FILE_NAME = "f90tst_nc4_par.nc"
integer :: nmode, ierr, fh, my_task, nprocs, i, varid
integer :: dimid(3), start(3), count(3)
real :: f(3)
call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, my_task, ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD, nprocs, ierr)
if(nprocs/=8)then
stop 'requires 8 tasks'
end if
nmode = ior(NF90_CLOBBER,NF90_NETCDF4)
nmode = IOR(nmode, nf90_mpiio)
call handle_err(nf90_create(FILE_NAME, nmode, fh, &
comm = MPI_COMM_WORLD, info = MPI_INFO_NULL))
call handle_err(nf90_set_fill(fh, NF90_NOFILL, nmode))
call handle_err(nf90_def_dim(fh, 'dim1', 6, dimid(1)))
call handle_err(nf90_def_dim(fh, 'dim2', 4, dimid(2)))
call handle_err(nf90_def_dim(fh, 'dim3', 1, dimid(3)))
call handle_err(nf90_def_var(fh, 'var1', NF90_DOUBLE, dimid, varid))
call handle_err(nf90_enddef(fh))
do i=1,3
f(i) = my_task*3+i
end do
count = (/3,1,1/)
start(1) = mod(my_task,2)*3+1
start(2) = my_task/2+1
start(3) = 1
print *,my_task, start, count, f
call handle_err(nf90_put_var(fh, varid, f,start=start,count=count))
call handle_err(nf90_close(fh))
! Reopen the file and check it.
call handle_err(nf90_open(FILE_NAME, NF90_MPIIO, fh, &
comm = MPI_COMM_WORLD, info = MPI_INFO_NULL))
call handle_err(nf90_get_var(fh, varid, f, start=start, count=count))
do i=1,3
if (f(i) .ne. my_task*3+i) stop 3
end do
call handle_err(nf90_close(fh))
call MPI_Finalize(ierr)
contains
! This subroutine handles errors by printing an error message and
! exiting with a non-zero status.
subroutine handle_err(errcode)
use netcdf
implicit none
integer, intent(in) :: errcode
if(errcode /= nf90_noerr) then
print *, 'Error: ', trim(nf90_strerror(errcode))
stop 2
endif
end subroutine handle_err
end program f90tst_nc4_par

View File

@ -22,10 +22,9 @@
integer NUM_PROC
parameter (NUM_PROC = 4)
integer ncid, varid, dimids(MAX_DIMS)
integer x_dimid, y_dimid, contig
integer x_dimid, y_dimid
integer data_out(NY / 2, NX / 2), data_in(NY / 2, NX / 2)
integer mode_flag
integer nvars, ngatts, ndims, unlimdimid, file_format
integer x, y, retval
integer p, my_rank, ierr
integer start(MAX_DIMS), count(MAX_DIMS)