compile genesis_mpi in CentOS

Moderators: cyao, soliday

Post Reply
yiding
Posts: 12
Joined: 21 Jun 2019, 07:15

compile genesis_mpi in CentOS

Post by yiding » 08 Jan 2020, 03:15

I'm trying to compile the mpi edition of GENESIS 2.0 source code in CentOS7.
I have modified the Makefile of genesis a littie:

#
# GENESIS makefile
#
#
SOURCE= main.f check.f diagno.f esource.f field.f incoherent.f \
math.f partsim.f pushp.f loadbeam.f loadrad.f magfield.f \
tdepend.f track.f string.f rpos.f scan.f source.f stepz.f \
timerec.f initrun.f input.f output.f mpi.f sdds.f
# output.f \
#
# LIB= -lmdbmth -lSDDS1 -lmdblib -lz
#
#OBJECTS =$(SOURCE:.f=.o)
#
#ifeq ($(EPICS_HOST_ARCH),win32-x86)
#COMPILER = ifort
#else
#COMPILER = g77
#endif
COMPILER = mpif77
#
# executable name
#
#EXECUTABLE = GENESIS
EXECUTABLE = genesis_mpi
#
...................
...............
ifeq ($(EPICS_HOST_ARCH),linux-x86_64)
LIB_DIR = $(HOME)/epics/extensions/lib/linux-x86_64
SDDS_FORTRAN_WRAPPER = $(HOME)/epics/extensions/src/SDDS/fortran/O.linux-x86_64/fortran_wrapper.o
LDFLAGS=$(SDDS_FORTRAN_WRAPPER) -Wl,-Bstatic -L$(LIB_DIR) -lmdbmth -lSDDS1 -lmdblib -lz -static-libgcc -lc
CFLAGS=-Wl,--build-id -O2 -ffixed-line-length-132 -Wall -fno-second-underscore -Wno-globals -Wimplicit -Wno-unused
endif


# targets
#
ifeq ($(EPICS_HOST_ARCH),win32-x86)
...............................
..................
else

GENESIS: $(SOURCE)
$(COMPILER) -g -w -O -Wall $(CFLAGS) -o $(EXECUTABLE) $(SOURCE) $(LDFLAGS)
@echo ' ******* end of linking ****** '

endif
..............................


When I run the make command, I've got the following error message.

mpif77 -g -w -O -Wall -Wl,--build-id -O2 -ffixed-line-length-132 -Wall -fno-second-underscore -Wno-globals -Wimplicit -Wno-unused -o genesis_mpi main.f check.f diagno.f esource.f field.f incoherent.f math.f partsim.f pushp.f loadbeam.f loadrad.f magfield.f tdepend.f track.f string.f rpos.f scan.f source.f stepz.f timerec.f initrun.f input.f output.f mpi.f sdds.f /home/liyd/epics/extensions/src/SDDS/fortran/O.linux-x86_64/fortran_wrapper.o -Wl,-Bstatic -L/home/liyd/epics/extensions/lib/linux-x86_64 -lmdbmth -lSDDS1 -lmdblib -lz -static-libgcc -lc
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
f951: warning: command line option ‘-Wimplicit’ is valid for C/ObjC but not for Fortran [enabled by default]
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_sigaction':
(.text+0x8a50): multiple definition of `__libc_sigaction'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(sigaction.o):(.text+0x20): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_fsync':
(.text+0x8160): multiple definition of `__libc_fsync'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(fsync.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__connect_nocancel':
(.text+0x7e29): multiple definition of `__connect_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(connect.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_fcntl':
(.text+0x7ca0): multiple definition of `__libc_fcntl'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(fcntl.o):(.text+0xa0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__fsync_nocancel':
(.text+0x8169): multiple definition of `__fsync_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(fsync.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `_IO_funlockfile':
(.text+0x89f0): multiple definition of `_IO_funlockfile'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(funlockfile.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_nanosleep':
(.text+0x8280): multiple definition of `__libc_nanosleep'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(nanosleep.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__read':
(.text+0x7b40): multiple definition of `__libc_read'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(read.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__open_nocancel':
(.text+0x82e9): multiple definition of `__open_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(open.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__lseek_nocancel':
(.text+0x81c9): multiple definition of `__lseek_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(llseek.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__read_nocancel':
(.text+0x7b49): multiple definition of `__read_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(read.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `send':
(.text+0x7ff0): multiple definition of `__libc_send'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(send.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_close':
(.text+0x7ba0): multiple definition of `__libc_close'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(close.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__open':
(.text+0x82e0): multiple definition of `__libc_open'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(open.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__write_nocancel':
(.text+0x7ae9): multiple definition of `__write_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(write.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `waitpid':
(.text+0x8580): multiple definition of `__libc_waitpid'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(waitpid.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__close_nocancel':
(.text+0x7ba9): multiple definition of `__close_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(close.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__fcntl_nocancel':
(.text+0x7c00): multiple definition of `__fcntl_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(fcntl.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__llseek':
(.text+0x81c0): multiple definition of `__libc_lseek'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(llseek.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `sigaction':
(.text+0x8c40): multiple definition of `__sigaction'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(sigaction.o):(.text+0x210): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__errno_location':
(.text+0x9ed0): multiple definition of `__errno_location'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(errno-loc.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `_IO_funlockfile':
(.text+0x89f0): multiple definition of `__funlockfile'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(funlockfile.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__lll_lock_wait_private':
(.text+0x7920): multiple definition of `__lll_lock_wait_private'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(libc-lowlevellock.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__write':
(.text+0x7ae0): multiple definition of `__libc_write'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(write.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__nanosleep_nocancel':
(.text+0x8289): multiple definition of `__nanosleep_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(nanosleep.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `connect':
(.text+0x7e20): multiple definition of `__libc_connect'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(connect.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__lll_unlock_wake_private':
(.text+0x79d0): multiple definition of `__lll_unlock_wake_private'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(libc-lowlevellock.o):(.text+0x30): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `raise':
(.text+0x88e0): multiple definition of `raise'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(raise.o):(.text+0x0): first defined here
/usr/local/mpich2/lib/libmpich.a(tcp_init.o): In function `MPID_nem_tcp_get_business_card':
tcp_init.c:(.text+0x3e3): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/liyd/epics/extensions/lib/linux-x86_64/libSDDS1.a(SDDS_lzma.o): In function `lzma_open':
/home/liyd/epics/extensions/src/SDDS/SDDSlib/O.linux-x86_64/../SDDS_lzma.c:61: undefined reference to `lzma_easy_encoder'
/home/liyd/epics/extensions/src/SDDS/SDDSlib/O.linux-x86_64/../SDDS_lzma.c:55: undefined reference to `lzma_auto_decoder'
/home/liyd/epics/extensions/lib/linux-x86_64/libSDDS1.a(SDDS_lzma.o): In function `lzma_close':
/home/liyd/epics/extensions/src/SDDS/SDDSlib/O.linux-x86_64/../SDDS_lzma.c:102: undefined reference to `lzma_end'
/home/liyd/epics/extensions/src/SDDS/SDDSlib/O.linux-x86_64/../SDDS_lzma.c:84: undefined reference to `lzma_code'
/home/liyd/epics/extensions/src/SDDS/SDDSlib/O.linux-x86_64/../SDDS_lzma.c:94: undefined reference to `lzma_end'
/home/liyd/epics/extensions/lib/linux-x86_64/libSDDS1.a(SDDS_lzma.o): In function `lzma_read':
/home/liyd/epics/extensions/src/SDDS/SDDSlib/O.linux-x86_64/../SDDS_lzma.c:133: undefined reference to `lzma_code'
/home/liyd/epics/extensions/lib/linux-x86_64/libSDDS1.a(SDDS_lzma.o): In function `lzma_gets':
/home/liyd/epics/extensions/src/SDDS/SDDSlib/O.linux-x86_64/../SDDS_lzma.c:180: undefined reference to `lzma_code'
/home/liyd/epics/extensions/lib/linux-x86_64/libSDDS1.a(SDDS_lzma.o): In function `lzma_write':
/home/liyd/epics/extensions/src/SDDS/SDDSlib/O.linux-x86_64/../SDDS_lzma.c:227: undefined reference to `lzma_code'
/home/liyd/epics/extensions/lib/linux-x86_64/libSDDS1.a(SDDS_lzma.o): In function `lzma_puts':
/home/liyd/epics/extensions/src/SDDS/SDDSlib/O.linux-x86_64/../SDDS_lzma.c:269: undefined reference to `lzma_code'
/home/liyd/epics/extensions/lib/linux-x86_64/libSDDS1.a(SDDS_lzma.o): In function `lzma_putc':
/home/liyd/epics/extensions/src/SDDS/SDDSlib/O.linux-x86_64/../SDDS_lzma.c:311: undefined reference to `lzma_code'
collect2: error: ld returned 1 exit status
make: *** [GENESIS] Error 1


I wonder what I can do to compile it correctly.

Thanks very much,

--Yiding Li

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: compile genesis_mpi in CentOS

Post by soliday » 08 Jan 2020, 11:59

Here is the current Makefile in SVN with your two changes for the compiler and the executable:

Code: Select all

#
# GENESIS makefile
#
#
SOURCE=  main.f check.f diagno.f esource.f field.f incoherent.f \
 math.f partsim.f pushp.f loadbeam.f loadrad.f magfield.f \
 tdepend.f track.f string.f rpos.f scan.f source.f stepz.f \
 timerec.f initrun.f  input.f output.f mpi.f sdds.f
# output.f  \
#
# LIB=  -lmdbmth -lSDDS1 -lmdblib -lz 
#
#OBJECTS =$(SOURCE:.f=.o)
#
#
#  executable name
#
EXECUTABLE = GENESIS
#



ifeq ($(EPICS_HOST_ARCH),win32-x86)
COMPILER = ifort
else
ifeq ($(MPI),1)
COMPILER = /head/home/backup/lustre/3rdPartySoftware/mvapich2-2.3b/bin/mpif77
#COMPILER = /lustre/3rdPartySoftware/mvapich2-1.9rc1/bin/mpif77
EXECUTABLE = GENESIS_mvapich2-2.3b
COMPILER = mpif77
EXECUTABLE = genesis_mpi
else
COMPILER = gfortran
endif
endif

ifeq ($(HOST_ARCH),solaris)
LIB_DIR = $(HOME)/epics/extensions/lib/solaris-sparc
SDDS_FORTRAN_WRAPPER = $(HOME)/epics/extensions/src/SDDS/fortran/O.solaris-sparc/fortran_wrapper.o
LDFLAGS=$(SDDS_FORTRAN_WRAPPER) -L$(LIB_DIR) -lmdbmth -lSDDS1 -lmdblib -lz
CFLAGS=-O2 -ffixed-line-length-132 -Wall -fno-second-underscore -Wno-globals -Wimplicit -Wno-unused
endif
ifeq ($(EPICS_HOST_ARCH),linux-x86)
LIB_DIR = $(HOME)/epics/extensions/lib/linux-x86
SDDS_FORTRAN_WRAPPER = $(HOME)/epics/extensions/src/SDDS/fortran/O.linux-x86/fortran_wrapper.o
LDFLAGS=$(SDDS_FORTRAN_WRAPPER) -Wl,-Bstatic -L$(LIB_DIR) -lmdbmth -lSDDS1 -lmdblib -lz -static-libgcc -lc
CFLAGS=-m32 -O2 -ffixed-line-length-132 -Wall -fno-second-underscore -Wno-globals -Wimplicit -Wno-unused
endif

ifeq ($(EPICS_HOST_ARCH),linux-x86_64)
LIB_DIR = $(HOME)/epics/extensions/lib/linux-x86_64
SDDS_FORTRAN_WRAPPER = $(HOME)/epics/extensions/src/SDDS/fortran/O.linux-x86_64/fortran_wrapper.o
ifeq ($(MPI),1)
LDFLAGS=$(SDDS_FORTRAN_WRAPPER) -L$(LIB_DIR) -lmdbmth -lSDDS1 -lmdblib -llzma -lz -lc
else
LDFLAGS=$(SDDS_FORTRAN_WRAPPER) -Wl,-Bstatic -L$(LIB_DIR) -lmdbmth -lSDDS1 -lmdblib -llzma -lz -static-libgcc -lc
endif
CFLAGS=-m64 -O2 -ffixed-line-length-132 -Wall -fno-second-underscore -Wno-globals -Wimplicit -Wno-unused
CFLAGS=-m64 -O2 -ffixed-line-length-132 -Wall -fno-second-underscore -Wno-unused
endif


# targets
#
ifeq ($(EPICS_HOST_ARCH),win32-x86)

OBJ =.obj

OBJNAMES = main$(OBJ) check$(OBJ) diagno$(OBJ) esource$(OBJ) field$(OBJ) incoherent$(OBJ) \
 math$(OBJ) partsim$(OBJ) pushp$(OBJ) loadbeam$(OBJ) loadrad$(OBJ) magfield$(OBJ) \
 tdepend$(OBJ) track$(OBJ) string$(OBJ) rpos$(OBJ) scan$(OBJ) source$(OBJ) stepz$(OBJ) \
 timerec$(OBJ) initrun$(OBJ)  input$(OBJ) output$(OBJ) mpi$(OBJ) sdds$(OBJ)

main$(OBJ):
	ifort /compile_only /threads /libs:dll main.f

check$(OBJ):
	ifort /compile_only /threads /libs:dll check.f

diagno$(OBJ):
	ifort /compile_only /threads /libs:dll diagno.f

esource$(OBJ):
	ifort /compile_only /threads /libs:dll esource.f

field$(OBJ):
	ifort /compile_only /threads /libs:dll field.f

incoherent$(OBJ):
	ifort /compile_only /threads /libs:dll incoherent.f

math$(OBJ):
	ifort /compile_only /threads /libs:dll math.f

partsim$(OBJ):
	ifort /compile_only /threads /libs:dll partsim.f

pushp$(OBJ):
	ifort /compile_only /threads /libs:dll pushp.f

loadbeam$(OBJ):
	ifort /compile_only /threads /libs:dll loadbeam.f

loadrad$(OBJ):
	ifort /compile_only /threads /libs:dll loadrad.f

magfield$(OBJ):
	ifort /compile_only /threads /libs:dll magfield.f

tdepend$(OBJ):
	ifort /compile_only /threads /libs:dll tdepend.f

track$(OBJ):
	ifort /compile_only /threads /libs:dll track.f

string$(OBJ):
	ifort /compile_only /threads /libs:dll string.f

rpos$(OBJ):
	ifort /compile_only /threads /libs:dll rpos.f

scan$(OBJ):
	ifort /compile_only /threads /libs:dll scan.f

source$(OBJ):
	ifort /compile_only /threads /libs:dll source.f

stepz$(OBJ):
	ifort /compile_only /threads /libs:dll stepz.f

timerec$(OBJ):
	ifort /compile_only /threads /libs:dll timerec.f

initrun$(OBJ):
	ifort /compile_only /threads /libs:dll initrun.f

input$(OBJ):
	ifort /compile_only /threads /libs:dll input.f

output$(OBJ):
	ifort /compile_only /threads /libs:dll output.f

mpi$(OBJ):
	ifort /compile_only /threads /libs:dll mpi.f

sdds$(OBJ):
	ifort /compile_only /threads /libs:dll sdds.f


#/F80000000
GENESIS: $(OBJNAMES)
	$(COMPILER) /exe:$(EXECUTABLE).exe /threads /libs:dll /F80000000 \
	$(OBJNAMES) \
	c:\\epics\\extensions\\src\\SDDS\\fortran\\O.$(EPICS_HOST_ARCH)\\fortran_wrapper.obj \
	/link /incremental:no /opt:ref /release \
	c:\\epics\\extensions\\lib\\$(EPICS_HOST_ARCH)\\mdbcommon.lib \
	c:\\epics\\extensions\\lib\\$(EPICS_HOST_ARCH)\\matlib.lib \
	c:\\epics\\extensions\\lib\\$(EPICS_HOST_ARCH)\\fftpack.lib \
	c:\\epics\\extensions\\lib\\$(EPICS_HOST_ARCH)\\SDDS1.lib \
	c:\\epics\\extensions\\lib\\$(EPICS_HOST_ARCH)\\rpnlib.lib \
	c:\\epics\\extensions\\lib\\$(EPICS_HOST_ARCH)\\namelist.lib \
	c:\\epics\\extensions\\lib\\$(EPICS_HOST_ARCH)\\mdbmth.lib \
	c:\\epics\\extensions\\lib\\$(EPICS_HOST_ARCH)\\mdblib.lib \
	c:\\epics\\extensions\\lib\\$(EPICS_HOST_ARCH)\\z.lib
	@echo ' ******* end of linking ****** '

else

GENESIS: $(SOURCE)
	@cp mpi.f.single mpi.f
	@cp mpif.h.single mpif.h
	$(COMPILER) -g -w -O -Wall $(CFLAGS) -o $(EXECUTABLE) $(SOURCE) $(LDFLAGS)
	@echo ' ******* end of linking ****** '

GENESIS_mvapich2-2.3b: $(SOURCE)
	@cp mpi.f.multi mpi.f
	@rm mpif.h
	$(COMPILER) -g -w -O -Wall $(CFLAGS) -o $(EXECUTABLE) $(SOURCE) $(LDFLAGS)
	@echo ' ******* end of linking ****** '


endif

clean:
	rm -f *~
	rm -f *.o *.obj genesis GENESIS GENESIS_mpi

install:
	cp ./$(EXECUTABLE) ~/bin/

single:
	cp mpi.f.single mpi.f
	cp mpif.h.single mpif.h

multi:
	cp mpi.f.multi mpi.f
	rm mpif.h

When I run it I get:

Code: Select all

> make MPI=1
mpif77 -g -w -O -Wall -m64 -O2 -ffixed-line-length-132 -Wall -fno-second-underscore -Wno-unused -o genesis_mpi main.f check.f diagno.f esource.f field.f incoherent.f math.f partsim.f pushp.f loadbeam.f loadrad.f magfield.f tdepend.f track.f string.f rpos.f scan.f source.f stepz.f timerec.f initrun.f  input.f output.f mpi.f sdds.f /home/phoebus/SOLIDAY/epics/extensions/src/SDDS/fortran/O.linux-x86_64/fortran_wrapper.o -L/home/phoebus/SOLIDAY/epics/extensions/lib/linux-x86_64 -lmdbmth -lSDDS1 -lmdblib -llzma -lz -lc
 ******* end of linking ****** 

yiding
Posts: 12
Joined: 21 Jun 2019, 07:15

Re: compile genesis_mpi in CentOS

Post by yiding » 09 Jan 2020, 20:10

Thank you for your timely help.
This makefile seems quite different from the one I downloaded from here:
111.jpg
I compiled genesis2.0_mpi successfully by using the new Makefile, and It works properly in single-thread.
However, when I run it with mpiexec, the error message comes:

Code: Select all

mpiexec -np 20 /home/admin/oagsoftware/oag/apps/src/genesis/genesis2.0_mpi
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
-------------------------------
Genesis 2.0 has begun execution
(Version 1.0 Unix)

Please enter input file name 
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
At line 254 of file input.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
lcls_wake_CU.in
SDDS output [Y]es/[N]o 
n
***  Input-warning: no harmonic output above NHARM
***  Warning: Size of history file [Mbytes]:1442      
Slice     1: Simulation  10% completed.
Slice     1: Simulation  20% completed.
Slice     1: Simulation  30% completed.
Slice     1: Simulation  40% completed.
Slice     1: Simulation  50% completed.
Slice     1: Simulation  60% completed.
Slice     1: Simulation  70% completed.
And it still works in single-thread. Is there any way to solve this problem?

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: compile genesis_mpi in CentOS

Post by soliday » 10 Jan 2020, 16:14

There were multiple problems with GENESIS built against the current SDDS source code tree. I think I fixed all the problems. I have put up a new link to the source code and updated the date. Let me know if this works for you.

yiding
Posts: 12
Joined: 21 Jun 2019, 07:15

Re: compile genesis_mpi in CentOS

Post by yiding » 11 Jan 2020, 20:45

Thanks for your kindly help.
It seems the Makefile in the download link hasn't changed yet, and it still doesn't work.
I copied the new makefile you posted in this topic, and made genesis_mpi seccessfully, but it does not
work correctly in multi-threads, and gives the same error message as I posted last time.
It seems the program has a problom in reading input files when it runs in multi-threads.

yiding
Posts: 12
Joined: 21 Jun 2019, 07:15

Re: compile genesis_mpi in CentOS

Post by yiding » 11 Jan 2020, 21:25

Sorry. I've made a mistake. I downloaded the old version.
Now I refresh the firefox cache and download the new codes.
When I compile the new codes, there comes an error message as:

Code: Select all

$ make MPI=1
 ******* moving correct mpi.f file into place ****** 
mpif77 -g -w -O -Wall -m64 -O2 -ffixed-line-length-132 -Wall -fno-second-underscore -Wno-unused -o GENESIS_mpi main.f check.f diagno.f esource.f field.f incoherent.f math.f partsim.f pushp.f loadbeam.f loadrad.f magfield.f tdepend.f track.f string.f rpos.f scan.f source.f stepz.f timerec.f initrun.f  input.f output.f mpi.f sdds.f /home/fermion/epics/extensions/src/SDDS/fortran/O.linux-x86_64/fortran_wrapper.o -L/home/fermion/epics/extensions/lib/linux-x86_64 -lSDDSmpi -lrpnlib -lmdbmth -lmdblib -llzma -lz -lgsl -lgslcblas -lc
/usr/bin/ld: cannot find -lSDDSmpi
/usr/bin/ld: cannot find -lgsl
/usr/bin/ld: cannot find -lgslcblas
collect2: error: ld returned 1 exit status
make: *** [GENESIS] Error 1

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: compile genesis_mpi in CentOS

Post by soliday » 13 Jan 2020, 12:09

SDDSmpi is built in epics/extensions/src/SDDS/SDDSlib
You have to run "make clean ; make MPI=1" in this directory.

As for the gsl library, try removing "-lgsl -lgslcblas" from the Makefile and see if it links without those libraries.

yiding
Posts: 12
Joined: 21 Jun 2019, 07:15

Re: compile genesis_mpi in CentOS

Post by yiding » 16 Jan 2020, 06:49

Thank you very much!
It works! :D

Post Reply