0

I apologize in advance if there's any ambiguity or wrong assertions in the question; I am relatively new to coding on this level. I am trying to generate an executable file using gfortran compiler that simulates a process in a 3D box but upon increasing the lattice size above a certain number (260*260*260) I get the following error:

"ld: 32-bit RIP relative reference out of range (2815218195 max is +/-2GB): from energy (0x100010630) to _rho.3920 (0x1A7CDDC00) in 'energy' from energy_global.o for architecture x86_64 collect2: error: ld returned 1 exit status "

The make file that I'm using looks like this:

    FC=gfortran
    FSTRICT=-Wextra -Wno-unused -Wsurprising -Wall #-Wimplicit #- pedantic
    FVECTORIZE=-ftree-vectorizer-verbose=2 -ftree-vectorize -ftree-vect-loop-version
    FOPTIMIZE=-fvariable-expansion-in-unroller -funroll-loops $(FVECTORIZE)
    OPTS = -O3 -g $(FOPTIMIZE)  #-fopenmp -mcmodel=large

    FFLAGS = $(OPTS) $(PROF)
    LDFLAGS = $(FFLAGS)

     #
    OBJ = crankNicolsonMain_global.o \
          stringsplint_global.o \
          initfunc_global.o \
          u1.icconfiguration_global.o \
          averageforhalfstep_global.o \
          crankNicholsonChangename_global.o \
          energy_global.o\
          extrapolate_global.o\
          evolveeulerPBC_global.o \
          derivatives6thOrderPBC_global.o \
          derivatives6thOrder_global.o \
          ffluxesNumRelPBC_global.o \
          ffluxesNumRel_global.o \
          fdfluxesNumRelPBC_global.o \
          fdfluxesNumRel_global.o \
          crankNicholsonLeapforwardPBC_global.o \

    all: csym.out

    .f.o:
    $(FC) $(FFLAGS) -c $*.f

    csym.out: $(OBJ)
    $(FC) -o  $@ $(LDFLAGS) $(OBJ)

    cleanf:
    rm -f *.o *.dvi *.aux *.log core.* *~

This combine all the different parts named in the makefile and put out a executive file named csym.out. As you can see, I have specified mcmodel=large in the makefile but this still happens. I'd appreciate any comment.

Ali N.
  • 1
  • 1
  • Welcome, please read [ask] and [mcve]. We need to know what you are doing when you get this error. We need to see your code (make it as small as possible while keeping the error) and your complete exact gfortran command. Please be sure to read https://stackoverflow.com/questions/12916176/gfortran-for-dummies-what-does-mcmodel-medium-do-exactly and try to use that option: **`-mcmodel=medium`**. However, I **strongly** suggest to use allocatable arrays instead. – Vladimir F Героям слава Apr 15 '21 at 06:55
  • @Vladimir F Many thanks for your response. The reason that the title and the question in general are a bit vague is because I don't know how to exactly describe the problem since I have little idea what's it all about and I don't want to confuse people with wrong descriptions. I added the code in the makefile to make it more clear. As it is shown in the code block, the rest of the code is very large and couldn't be put here. Also, I had tried the solution mentioned in the link you have attache and it did not help (using -mcmodel=medium) – Ali N. Apr 16 '21 at 06:29
  • 1
    The option is commented out. Are you sure it was actually used in your tests? – Vladimir F Героям слава Apr 16 '21 at 07:16
  • 1
    Sorry for responding so late. The problem was solved. It was a mistake in another part of the code. – Ali N. Aug 10 '21 at 19:50

0 Answers0