Makefile
===
FC=ifort
CC=icc
foo: mainf.o fmemset.o
$(FC) mainf.o fmemset.o -o foo
mainf.o: mainf.f90
$(FC) -c mainf.f90 -o mainf.o
fmemset.o: fmemset.c
$(CC) -c fmemset.c -o fmemset.o
run:
./foo
clean:
/bin/rm -f *.o ./foo
===
FORTRAN code: mainf.f90
===
program Albert
integer :: x,y
real :: a(4,4)
do 20 i=1,4
do 10 j=1,4
a(i,j) = 4
write (*,*) a(i,j)
10 continue
20 continue
! zeroing out 4*4 elements, each of 4 bytes
call fmemset(a,4*4*4)
write (*,*) "UPDATED ARRAY:"
do 40 i=1,4
do 30 j=1,4
write (*,*) a(i,j)
30 continue
40 continue
write(*,*) size(a)
end program Albert
===
C code: fmemset.c
===
#include
void fmemset_(void *a, int *n) {
memset(a,0,*n);
}
===
Developed by Prof. Henri Casanova at UHM. Thanks!
No comments:
Post a Comment