-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00ad7c6
commit dfa02db
Showing
51 changed files
with
25,180 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
! FreeIPC - A library to allow Fortran programs that use MPI | ||
! to easily access shared memory within multicore nodes | ||
! Date - 23rd Oct Version 0.0 | ||
! Copyright(C) 2009 Ian Bush | ||
! | ||
! This library is free software; you can redistribute it and/or | ||
! modify it under the terms of the GNU Lesser General Public | ||
! License as published by the Free Software Foundation; either | ||
! version 3.0 of the License, or (at your option) any later version. | ||
! | ||
! This library is distributed in the hope that it will be useful, | ||
! but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
! Lesser General Public License for more details. | ||
! | ||
! You should have received a copy of the GNU Lesser General Public | ||
! License along with this library; if not, write to the Free Software | ||
! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
! | ||
! | ||
! This library is released under LGPL. The full text of LGPL may be found | ||
! at http://www.gnu.org/licenses/lgpl-3.0.txt | ||
! | ||
! In particular, the terms of the GNU LGPL imply that you CAN use this library with | ||
! proprietary code with some restrictions (you can link, but not use the code directly). | ||
! Please consult the above URL for exact details. | ||
|
||
Type( c_ptr ) :: shmaddr | ||
|
||
! Check things are initialized | ||
If( .Not. Associated( FIPC_ctxt_world%initialized ) ) Then | ||
error = FIPC_not_initialized | ||
Return | ||
End If | ||
|
||
If( Size( n ) < rank ) Then | ||
error = FIPC_insufficient_dims | ||
End If | ||
|
||
Call segment_create( type, rank, Int( n( 1:rank ), c_long ), ctxt, shmaddr, error ) | ||
If( error /= 0 ) Then | ||
Return | ||
End If | ||
|
||
Call c_f_pointer( shmaddr, a, Int( n( 1:rank ), c_long ) ) | ||
|
||
error = FIPC_success | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
! FreeIPC - A library to allow Fortran programs that use MPI | ||
! to easily access shared memory within multicore nodes | ||
! Date - 23rd Oct Version 0.0 | ||
! Copyright(C) 2009 Ian Bush | ||
! | ||
! This library is free software; you can redistribute it and/or | ||
! modify it under the terms of the GNU Lesser General Public | ||
! License as published by the Free Software Foundation; either | ||
! version 3.0 of the License, or (at your option) any later version. | ||
! | ||
! This library is distributed in the hope that it will be useful, | ||
! but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
! Lesser General Public License for more details. | ||
! | ||
! You should have received a copy of the GNU Lesser General Public | ||
! License along with this library; if not, write to the Free Software | ||
! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
! | ||
! | ||
! This library is released under LGPL. The full text of LGPL may be found | ||
! at http://www.gnu.org/licenses/lgpl-3.0.txt | ||
! | ||
! In particular, the terms of the GNU LGPL imply that you CAN use this library with | ||
! proprietary code with some restrictions (you can link, but not use the code directly). | ||
! Please consult the above URL for exact details. | ||
|
||
Type( FIPC_ctxt ) :: ctxt | ||
|
||
Type( segment_list_type ), Pointer :: p | ||
|
||
! Check things are initialized | ||
If( .Not. Associated( FIPC_ctxt_world%initialized ) ) Then | ||
error = FIPC_not_initialized | ||
Return | ||
End If | ||
|
||
If( .Not. Associated( a ) ) Then | ||
error = FIPC_free_null_pointer | ||
Return | ||
End If | ||
|
||
! First find the segment | ||
! Be careful to only look at segments that could possible be associated | ||
! with this pointer | ||
p => seg_list | ||
Do While( Associated( p ) ) | ||
If( p%data%type == type ) Then | ||
If( Size( p%data%sizes ) == Size( Shape( a ) ) ) Then | ||
If( All( p%data%sizes == Shape( a ) ) ) Then | ||
Call c_f_pointer( p%data%shmaddr, fp, p%data%sizes ) | ||
If( Associated( a, fp ) ) Then | ||
Exit | ||
End If | ||
End If | ||
End If | ||
End If | ||
p => p%next | ||
End Do | ||
|
||
If( .Not. Associated( p ) ) Then | ||
error = FIPC_seg_not_found | ||
Return | ||
End If | ||
|
||
If( debug ) Then | ||
ctxt = p%data%ctxt | ||
End If | ||
|
||
Call segment_free( p%data%shmid, error ) | ||
If( error /= FIPC_success ) Then | ||
Return | ||
End If | ||
|
||
a => Null() | ||
|
||
If( debug ) Then | ||
Call print_seg_list( ctxt ) | ||
End If | ||
|
||
error = FIPC_success | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#======================================================================= | ||
# Makefile for Imcompact3D | ||
#======================================================================= | ||
|
||
# Choose pre-processing options | ||
# -DSHM - enable shared-memory implementation | ||
# -DDOUBLE_PREC - use double-precision | ||
OPTIONS = -DDOUBLE_PREC | ||
|
||
# Choose an FFT engine, available options are: | ||
# fftw3 - FFTW version 3.x | ||
# generic - A general FFT algorithm (no 3rd-party library needed) | ||
FFT= generic | ||
|
||
# Paths to FFTW 3 | ||
FFTW3_PATH= # full path of FFTW installation if using fftw3 engine above | ||
FFTW3_INCLUDE = -I$(FFTW3_PATH)/include | ||
FFTW3_LIB = -L$(FFTW3_PATH)/lib -lfftw3 -lfftw3f | ||
|
||
# Specify Fortran and C compiler names and flags here | ||
# Normally, use MPI wrappers rather than compilers themselves | ||
# Supply a Fortran pre-processing flag together with optimisation level flags | ||
# Some examples are given below: | ||
|
||
#FC = | ||
#OPTFC = | ||
#CC = | ||
#CFLAGS = | ||
|
||
# PGI | ||
#FC = ftn | ||
#OPTFC = -fast -O3 -Mpreprocess | ||
#CC = cc | ||
#CFLAGS = -O3 | ||
|
||
# PathScale | ||
#FC = ftn | ||
#OPTFC = -Ofast -cpp | ||
#CC = cc | ||
#CFLAGS = -O3 | ||
|
||
# GNU | ||
FC = mpif90 | ||
OPTFC = -O3 -funroll-loops -ftree-vectorize -fcray-pointer -cpp | ||
CC = mpicc | ||
CFLAGS = -O3 | ||
|
||
# Cray | ||
#FC = ftn | ||
#OPTFC = -e Fm | ||
#CC = cc | ||
#CFLAGS = | ||
|
||
#----------------------------------------------------------------------- | ||
# Normally no need to change anything below | ||
|
||
# include PATH | ||
ifeq ($(FFT),generic) | ||
INC= | ||
else ifeq ($(FFT),fftw3) | ||
INC=$(FFTW3_INCLUDE) | ||
endif | ||
|
||
# library path | ||
ifeq ($(FFT),generic) | ||
LIBFFT= | ||
else ifeq ($(FFT),fftw3) | ||
LIBFFT=$(FFTW3_LIB) | ||
endif | ||
|
||
# List of source files | ||
SRC = decomp_2d.f90 glassman.f90 fft_$(FFT).f90 module_param.f90 io.f90 variables.f90 poisson.f90 schemes.f90 convdiff.f90 incompact3d.f90 navier.f90 filter.f90 derive.f90 parameters.f90 tools.f90 visu.f90 saveBox.f90 | ||
|
||
#----------------------------------------------------------------------- | ||
# Normally no need to change anything below | ||
|
||
ifneq (,$(findstring DSHM,$(OPTIONS))) | ||
SRC := FreeIPC.f90 $(SRC) | ||
OBJ = $(SRC:.f90=.o) alloc_shm.o FreeIPC_c.o | ||
else | ||
OBJ = $(SRC:.f90=.o) | ||
endif | ||
|
||
all: incompact3d | ||
|
||
alloc_shm.o: alloc_shm.c | ||
$(CC) $(CFLAGS) -c $< | ||
|
||
FreeIPC_c.o: FreeIPC_c.c | ||
$(CC) $(CFLAGS) -c $< | ||
|
||
incompact3d : $(OBJ) | ||
$(FC) -O3 -o $@ $(OBJ) $(LIBFFT) | ||
|
||
%.o : %.f90 | ||
$(FC) $(OPTFC) $(OPTIONS) $(INC) -c $< | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f *.o *.mod incompact3d | ||
|
||
.PHONY: realclean | ||
realclean: clean | ||
rm -f *~ \#*\# |
Oops, something went wrong.