Skip to content

Commit

Permalink
MPI functionality added through makefiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
edoerner committed Jan 28, 2019
1 parent e8b2904 commit 9aa6f5e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
17 changes: 14 additions & 3 deletions HEN_HOUSE/makefiles/beam_makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,17 @@ $(FORTRAN_FILE).$(FEXT): $(SOURCES) sources.make
@$(MORTRAN_EXE) -d $(MORTRAN_DATA) -f $(SOURCES) -o7 $@ \
-o8 $(FORTRAN_FILE).mortlst

#*******************************************************************************
# #PARALLEL_EGS - Disable PJOB functionality for BEAMnrc libraries due to
# locking problems when used from dosxyznrc parallel execution
#*******************************************************************************
library: $(LIB_FILE)

$(LIB_FILE): $(LIB_FORTRAN_FILE).$(FOBJE)
$(F77_LINK) $(SHLIB_FLAGS) $(FCFLAGS) $(OPTLEVEL_F) $(FOUT)$@ $(LIB_FORTRAN_FILE).$(FOBJE) $(BEAM_EXTRA_OBJECTS) $(FLIBS) $(SHLIB_LIBS)
$(F77_LINK) $(SHLIB_FLAGS) $(FCFLAGS) -D_NOPJOB $(OPTLEVEL_F) $(FOUT)$@ $(LIB_FORTRAN_FILE).$(FOBJE) $(BEAM_EXTRA_OBJECTS) $(FLIBS) $(SHLIB_LIBS)

$(LIB_FORTRAN_FILE).$(FOBJE): $(LIB_FORTRAN_FILE).$(FEXT)
$(F77) -c $(FCFLAGS) $(OPTLEVEL_F) $(FOUT)$@ $(LIB_FORTRAN_FILE).$(FEXT)
$(F77) -c $(FCFLAGS) -D_NOPJOB $(OPTLEVEL_F) $(FOUT)$@ $(LIB_FORTRAN_FILE).$(FEXT)

$(LIB_FORTRAN_FILE).$(FEXT): $(LIB_SOURCES) sources.make
@echo "Mortran compilation for $@"
Expand Down Expand Up @@ -154,15 +158,22 @@ noopt:
debug:
@$(MAKE) WHAT=_debug OPTLEVEL_F="$(FDEBUG)" OPTLEVEL_C="$(CDEBUG)"

#*******************************************************************************
# #PARALLEL_EGS - Build a optimized user code with MPI support
#*******************************************************************************
mpi:
@$(MAKE) -s WHAT=_mpi F77=mpif90 FCFLAGS="$(FCFLAGS) -D_MPI"

clean:
@echo "$(REMOVE) mortjob.mortran $(FORTRAN_FILE).$(FEXT) $(FORTRAN_FILE).mortlst"
@$(REMOVE) mortjob.mortran $(FORTRAN_FILE).$(FEXT) $(FORTRAN_FILE).mortlst
@$(MAKE) -s WHAT=_debug execlean
@$(MAKE) -s WHAT=_noopt execlean
@$(MAKE) -s WHAT=_mpi execlean
@$(MAKE) -s WHAT= execlean

execlean:
@echo "$(REMOVE) $(EXE_FILE)"
$(REMOVE) $(EXE_FILE)

.PHONY: opt noopt debug clean execlean
.PHONY: opt noopt debug mpi clean execlean
11 changes: 9 additions & 2 deletions HEN_HOUSE/makefiles/standard_makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,27 @@ opt:

# Build a user code without optimization
noopt:
@$(MAKE) -s WHAT=_noopt OPTLEVEL_F= OPTLEVEL_C=
@$(MAKE) -s WHAT=_mpi OPTLEVEL_F= OPTLEVEL_C=
# @($(MAKE) -s WHAT=_noopt OPTLEVEL_F= OPTLEVEL_C= && echo $(ok_message)) || echo $(failed_message)

# Build a user code for debugging
debug:
@$(MAKE) -s WHAT=_debug OPTLEVEL_F="$(FDEBUG)" OPTLEVEL_C="$(CDEBUG)"
#@($(MAKE) -s WHAT=_debug OPTLEVEL_F="$(FDEBUG)" OPTLEVEL_C="$(CDEBUG)" && echo $(ok_message)) || echo $(failed_message)

#*******************************************************************************
# #PARALLEL_EGS - Build a optimized user code with MPI support
#*******************************************************************************
mpi:
@$(MAKE) -s WHAT=_mpi F77=mpif90 FCFLAGS="$(FCFLAGS) -D_MPI"

# Clean-up the user code directory.
clean:
@echo "$(REMOVE) mortjob.mortran $(FORTRAN_FILE).$(FEXT) $(FORTRAN_FILE).mortlst"
@$(REMOVE) mortjob.mortran $(FORTRAN_FILE).$(FEXT) $(FORTRAN_FILE).mortlst
@$(MAKE) -s WHAT=_debug execlean
@$(MAKE) -s WHAT=_noopt execlean
@$(MAKE) -s WHAT=_mpi execlean
@$(MAKE) -s WHAT= execlean
@echo $(ok_message)

Expand All @@ -180,4 +187,4 @@ execlean:
# execlean have no list of prerequisits so that make can determine whether
# they need to be remade, we declare them as phony.
#
.PHONY: opt noopt debug clean execlean
.PHONY: opt noopt debug mpi clean execlean
6 changes: 6 additions & 0 deletions HEN_HOUSE/src/egs_utilities.mortran
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,12 @@ IF( arg(l-5:l) = '_debug' ) [
IF( arg(l-5:l) = '_noopt' ) [
arg(l-5:l) = ' '; l = l-5;
]
"*******************************************************************************
" #PARALLEL_EGS - Added IF sentence when user code is compiled with MPI.
"*******************************************************************************
IF( arg(l-3:l) = '_mpi' ) [
arg(l-3:l) = ' '; l = l - 4;
]
l1 = len(ucode);
IF( l > l1 ) [
$egs_fatal(*,' user code name is too long (',l,' chars)');
Expand Down

0 comments on commit 9aa6f5e

Please sign in to comment.