1
1
This commit was SVN r3962.
Этот коммит содержится в:
Craig E Rasmussen 2005-01-12 16:00:32 +00:00
родитель bce922bb05
Коммит d72f5d3d7f
3 изменённых файлов: 173 добавлений и 0 удалений

40
src/mpi/f90/test/align_c.c Обычный файл
Просмотреть файл

@ -0,0 +1,40 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
void align_c(char *w, char *x, char *y, char *z)
{
unsigned long aw, ax, ay, az;
FILE *f=stdout;
if (!f) exit(1);
aw = (unsigned long) w;
ax = (unsigned long) x;
ay = (unsigned long) y;
az = (unsigned long) z;
if (! ((aw%16)||(ax%16)||(ay%16)||(az%16))) {
fprintf(f, " %d\t", 16);
}
else if (! ((aw%12)||(ax%12)||(ay%12)||(az%12))) {
fprintf(f, " %d\t", 12);
}
else if (! ((aw%8)||(ax%8)||(ay%8)||(az%8))) {
fprintf(f, " %d\t", 8);
}
else if (! ((aw%4)||(ax%4)||(ay%4)||(az%4))) {
fprintf(f, " %d\t", 4);
}
else if (! ((aw%2)||(ax%2)||(ay%2)||(az%2))) {
fprintf(f, " %d\t", 2);
}
else {
fprintf(f, " %d\t", 1);
}
fflush(f);
}
#ifdef __cplusplus
}
#endif

90
src/mpi/f90/test/print_align.f90 Обычный файл
Просмотреть файл

@ -0,0 +1,90 @@
!
! Copyright (c) 2004-2005 The Trustees of Indiana University.
! All rights reserved.
! Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
! All rights reserved.
! Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
! University of Stuttgart. All rights reserved.
! $COPYRIGHT$
!
! Additional copyrights may follow
!
! $HEADER$
!
! print_align.f90
! - prints out alignment of real types
!
module OMPI_TEST_ALIGN
type AlignReal
character a
real(selected_real_kind(6)) :: w
character b
real(selected_real_kind(6)) :: x
real(selected_real_kind(6)) :: y
character c
real(selected_real_kind(6)) :: z
end type
type AlignDouble
character a
real(selected_real_kind(15)) :: w
character b
real(selected_real_kind(15)) :: x
real(selected_real_kind(15)) :: y
character c
real(selected_real_kind(15)) :: z
end type
type AlignQuad
character a
real(selected_real_kind(31)) :: w
character b
real(selected_real_kind(31)) :: x
real(selected_real_kind(31)) :: y
character c
real(selected_real_kind(31)) :: z
end type
type AlignComplex
character a
complex(selected_real_kind(6)) :: w
character b
complex(selected_real_kind(6)) :: x
complex(selected_real_kind(6)) :: y
character c
complex(selected_real_kind(6)) :: z
end type
type AlignDoubleComplex
character a
complex(selected_real_kind(15)) :: w
character b
complex(selected_real_kind(15)) :: x
complex(selected_real_kind(15)) :: y
character c
complex(selected_real_kind(15)) :: z
end type
end module
program main
use OMPI_TEST_ALIGN
external align_c
type(AlignReal) :: ar
type(AlignDouble) :: ad
type(AlignQuad) :: aq
type(AlignComplex) :: ac
type(AlignDoubleComplex) :: adc
call align_c(ar%w, ar%x, ar%y, ar%z)
print *, "is alignment of real"
call align_c(ad%w, ad%x, ad%y, ad%z)
print *, "is alignment of double"
call align_c(aq%w, aq%x, aq%y, aq%z)
print *, "is alignment of quad"
call align_c(ac%w, ac%x, ac%y, ac%z)
print *, "is alignment of complex"
call align_c(adc%w, adc%x, adc%y, adc%z)
print *, "is alignment of double complex"
end program main

43
src/mpi/f90/test/print_prec_range.f90 Обычный файл
Просмотреть файл

@ -0,0 +1,43 @@
!
! Copyright (c) 2004-2005 The Trustees of Indiana University.
! All rights reserved.
! Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
! All rights reserved.
! Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
! University of Stuttgart. All rights reserved.
! $COPYRIGHT$
!
! Additional copyrights may follow
!
! $HEADER$
!
! print_prec_range.f90
! - prints out values of precision and range for real types
!
program main
real :: xr
real(kind(1.0D0)) :: xd
real(selected_real_kind(5)) :: x5
real(selected_real_kind(6)) :: x6
real(selected_real_kind(7)) :: x7
real(selected_real_kind(14)) :: x14
real(selected_real_kind(15)) :: x15
real(selected_real_kind(16)) :: x16
real(selected_real_kind(30)) :: x30
real(selected_real_kind(31)) :: x31
real(selected_real_kind(32)) :: x32
print *, "precision(p=5) = ", precision(x5), " range(p=5) = ", range(x5)
print *, "precision(p=6) = ", precision(x6), " range(p=6) = ", range(x6)
print *, "precision(p=7) = ", precision(x7), " range(p=7) = ", range(x7)
print *, "precision(p=14) = ", precision(x14), " range(p=14) = ", range(x14)
print *, "precision(p=15) = ", precision(x15), " range(p=15) = ", range(x15)
print *, "precision(p=16) = ", precision(x16), " range(p=16) = ", range(x16)
print *, "precision(p=30) = ", precision(x30), " range(p=30) = ", range(x30)
print *, "precision(p=31) = ", precision(x31), " range(p=31) = ", range(x31)
print *, "precision(p=32) = ", precision(x32), " range(p=32) = ", range(x32)
print *
print *, "precision(r) = ", precision(xr), " range(r) = ", range(r)
print *, "precision(d) = ", precision(xd), " range(d) = ", range(d)
end program main