Loading ...
Sorry, an error occurred while loading the content.

CNS fast on Opteron with gnu and Portland Group PGI Compiler

Expand Messages
  • marcelreese
    Message related to: http://www.pgroup.com/userforum/viewtopic.php?p=651#651 ### Dear All, Actually I had succesfully compiled CNS before on an Opteron
    Message 1 of 2 , Apr 12, 2005
    • 0 Attachment
      Message related to:
      http://www.pgroup.com/userforum/viewtopic.php?p=651#651
      ###
      Dear All,

      Actually I had succesfully compiled CNS before on an Opteron (2GHz)but
      used gcc 3.3.3 compiler, which was pretty slow in comparision to Xeon
      3,06Ghz: 9min/5min for 100ps MD with my molecular system. I also used
      very optimized code from the Xeon Compilation directly which was even
      slower: 10min. With my present Opteron Portland Group compilation I
      reach 5min like in the Xeon case. ( I don't have seconds or such)

      Here I will give you the neccessary modifications to files. I was only
      interesed to make things fast. Might be someone tries to make it nice,
      too?

      1. Step:

      modify cns_solve_1.1//bin/getarch, make a copy first. This script will
      identify your machine for cns before compilation, or not. For the
      opteron I just added the line with my favorite architecture name:

      echo "linux_opteron_pgcompiler"

      before the exit and commented out the line:

      #echo "unknown-${MACHINE}-${SYSTEM}"

      Now the opteron is "detected" when no other architecture is detected.
      This is DIRTY

      2. Step
      Add a approprotate "supported" machine type subdirectory with the same
      architecture name as used above:
      cd cns_solve_1.1
      cp -r instlib/machine/supported/linux
      instlib/machine/supported/linux_opteron_pgcompiler

      3. Step
      Modify the compilation options in
      instlib/machine/supported/linux_opteron_pgcompiler/Makefile.header

      Here the Portlandgroup Compiler setup:
      ###############################################################################
      # #
      # Machine dependent Makefile header for CNSsolve #
      # Paul Adams 20-10-98 #
      # copyright Yale University #
      # #
      ###############################################################################

      # fortran options
      F77 = pgf77
      F77STD = -w -i8 -O3 -Mcache_align -Mdalign -Munixlogical -fastsse
      -Mipa=fast
      F77OPT = -i8 -O3 -Mcache_align -Mdalign -Munixlogical -fastsse -Mipa=fast
      F77FLAGS = $(F77STD) $(F77OPT) $(EXT_F77FLAGS) $(F77BUG)

      # C options
      CC = pgcc
      CCFLAGS = -c -DCNS_ARCH_TYPE_$(CNS_ARCH_TYPE) $(EXT_CCFLAGS) -O3
      -Mcache_align -Mdalign -fastsse -Mipa=fast

      # link options
      LD = pgf77
      LDFLAGS = $(EXT_LDFLAGS) -i8 -O3 -Mcache_align -Mdalign -Munixlogical
      -fastsse -Mipa=fast

      # utility programs
      compile-utils:
      @ cd $(CNS_INST)/utils; \
      make utils F77="$(F77)" CC="$(CC)" \
      F77FLAGS="-O" CCFLAGS="-O" \
      F77LINK="" CCLINK="-lm" LEXLIB="fl"

      #==============================================================================


      Here the gnu compiler setup for people who really need it, at least it
      works:
      ###############################################################################
      # #
      # Machine dependent Makefile header for CNSsolve #
      # Paul Adams 20-10-98 #
      # copyright Yale University #
      # #
      ###############################################################################

      # fortran options
      F77 = g77
      F77STD = -c -D_REENTRANT -O3 -fno-globals -Wno-globals -O3
      -malign-double -funroll-loops -frerun-loop-opt -ffast-math -m32 -msse2
      -mfpmath=sse,387
      #-w -Nn2000
      F77OPT = -c -D_REENTRANT -O3 -fno-globals -Wno-globals -O3
      -malign-double -funroll-loops
      -frerun-loop-opt-frerun-loop-opt-ffast-math -m32 -msse2 -mfpmath=sse,387
      F77FLAGS = -c -D_REENTRANT -O3 -fno-globals -Wno-globals -O3
      -malign-double -funroll-loops -frerun-loop-opt -ffast-math -m32 -msse2
      -mfpmath=sse,387

      # C options
      CC = gcc
      CCFLAGS = -c -D_REENTRANT -O3 -fno-globals -Wno-globals -O3
      -malign-double -funroll-loops -frerun-loop-opt -ffast-math -m32 -msse2
      -mfpmath=sse,387

      # link options
      LD = g77
      LDFLAGS = $(EXT_LDFLAGS) -D_REENTRANT -O3 -fno-globals -Wno-globals
      -O3 -malign-double -funroll-loops -frerun-loop-opt -ffast-math -m32
      -msse2 -mfpmath=sse,387

      # utility programs
      compile-utils:
      @ cd $(CNS_INST)/utils; \
      make utils F77="$(F77)" CC="$(CC)" \
      F77FLAGS="-O" CCFLAGS="-O" \
      F77LINK="" CCLINK="-lm" LEXLIB="fl"

      #==============================================================================

      4. Step:

      If you compile with gcc skip this -m32 solves the problem I got with
      the portland compiler (so then this step can be skipted):
      %ALLHP error encountered: out of INTEGER range
      (see previous messages)

      Edit cns_solve_1.1/source/dmemory.c and change line 7 from
      #define INTEGER int
      to
      #define INTEGER long long int.

      THIS IS DIRTY. I didn't check yet if this big INT size is really
      needed but the program works. If you compile the same source later on
      a different architecture you might come into trubble. So better make a
      copy of the original file. It would be very nice to use some -Dx_64
      precomilation flag for this, but sorry.

      5. Step
      cd .../cns_solve_1.1
      make install

      Should work now. I wonder if an -i8 flag for the pgcc compiler would
      have solved the problem in Step 4. Might be PGI considers this for
      later versions?! Your compiler really is very fast it would be nice to
      compile code like this easily.

      Kind regards,
      Marcel Reese
    • marcelreese
      Dear all, actually you can avoid changing the source code in the c-file because CNS is already prepared to take a differently defined INTEGER type. Just use
      Message 2 of 2 , Apr 20, 2005
      • 0 Attachment
        Dear all,

        actually you can avoid changing the source code in the c-file because
        CNS is already prepared to take a differently defined INTEGER type.
        Just use -DINTEGER="long long int" as an additional CCFLAG when using
        -i8 in the Fortran parts.


        Cheers,
        Marcel
      Your message has been successfully submitted and would be delivered to recipients shortly.