Menu

ncap2 OPENMP

Developers
2007-11-02
2013-10-17
  • henry Butowsky

    henry Butowsky - 2007-11-02

    HI Charlie,
    I trying to hack  nco++/Makefile  so that I can build ncap2 with openmp enabled.
    I've been looking closely at you bld/Makefile and think I have nabbed  the correct linker and compiler flags - but i cannot see in the make file where you define _OPENMP. Can you give me some clues ?

    Regards Henry

     
    • Charlie Zender

      Charlie Zender - 2007-11-02

      Henry,

      Enabling openmp in nco++/Makefile is premature.
      autoconf/automake generates all Makefile's and it
      needs to be set up to correctly handle absence/presence
      of openmp libraries on a per-compiler/OS basis.
      This will take a lot of autohackery.
      I'm afraid your configure.in patches would be too disruptive.

      Instead, I recommend you do as I do and build with
      bld/Makefile, nco_c++/Makefile.old, and nco++/Makefile.old.
      These are already set up to use openmp by default.
      The compiler will define _OPENMP itself if present.
      It's part of the openmp standard.
      No need to change anything.

      cd ~/nco/src/nco++;make -f Makefile.old OPTS=D all

      and/or

      cd ${HOME}/nco/bld;make OPTS=D allinone;cd -

      Will this work for you?

      Charlie

       
    • henry Butowsky

      henry Butowsky - 2007-11-09

      Hi Charlie,
      Have commit the first cut of openmp enabled ncap2. Its more a proof of concept rather than the finished article. At the moment it only works with regular variables (no attributes or RAM vars). Will see if it works on esmf (the acid test). I've got a bunch of questions about OPENMP and my implementation --so when you have some time...

      Regards Henry

       
    • henry Butowsky

      henry Butowsky - 2007-11-13

      Hi Charlie,
      The  basic block  of an 'if' body is recognized.
      Have messed about a little with the number of threads --It seems my nco ubuntu build get unstable when I specify more than 4 threads.
      Have tried again to build on esmf .. but having problems

      Regards Henry

       
    • Charlie Zender

      Charlie Zender - 2007-11-13

      Post the output of

      cd ${HOME}/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS2=N allinone;cd - # esmf

       
    • henry Butowsky

      henry Butowsky - 2007-11-13

      Here it is...

      gcc -std=c99 -pedantic -D_BSD_SOURCE -D_POSIX_SOURCE -M   -DLINUX -DNO_NETCDF_2 -DVERSION='20071113' -DHOSTNAME='esmf04m' -DUSER='hbutowsk' -DNCO_ABORT_ON_ERROR -DHAVE_REGEX_H -DNCO_HAVE_REGEX_FUNCTIONALITY -DHAVE_GETPAGESIZE -DHAVE_GETRUSAGE -DHAVE_MKSTEMP -DHAVE_GETOPT_H -DHAVE_GETOPT_LONG  -Di386 -I./ -I../src/nco -I/usr/local/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE ../src/nco/ncwa.c | perl -p -e 's/ncwa\.o/cszzscucszzschbutowskcszzscobjcszzscLINUX\/ncwa.o cszzscucszzschbutowskcszzscobjcszzscLINUX\/ncwa.d/g;s/cszzsc/\//g' > /u/hbutowsk/obj/LINUX/ncwa.d
      A file or directory in the path name does not exist.
      /usr/bin/sh: /u/hbutowsk/obj/LINUX/ncwa.d: 0403-005 Cannot create the specified file.
      gmake: *** [/u/hbutowsk/obj/LINUX/ncwa.d] Error 1
      esmf04m$ ../src/nco/ncwa.c:58:20: error: getopt.h: A file or directory in the path name does not exist.

       
    • Charlie Zender

      Charlie Zender - 2007-11-13

      Why does it think you're running Linux on the ESMF?

      export PVM_ARCH='AIX'

      and try it again. Make sure you have ~/sh/pvmgetarch

      Once your environment is correct, bld/Makefile will
      automatically use xlc_r/xlC_r compilers.

       
    • henry Butowsky

      henry Butowsky - 2007-11-15

      Hi Charlie,
      Have managed to build on AIX -- I had to set OPTS=R because  with OPTS=D the make was taking so long that I was being logged out before build was complete. Initial indications are that my implementation of OPENMP for ncap2 works .  However I have uncovered a bug in the AIX build -namely that LHS casting in scripts dos not work when the basic block is double parsed -So I have been trying to fix this. This error also occurs with the default ncap2  (/usr/local/bin/ncap2) on esmf , So its not a problem connected with openmp

      On my ubuntu build Im getting erratic errors with ncap2 when I set nbr_thd > 4 or if I attempt to time the process e.g   time ncap2 --t 4 -v -O -D 2 -S ncap13.in in.nc foo.nc. I tried a similer set up with ncbo - and I got no errors So I guess its a problem with my OPENMP code.

      Daniel It would be great if you could explain to me how to use ddd with threads So I locate the error

      Regards Henry   

       
      • Charlie Zender

        Charlie Zender - 2007-11-15

        Hi Henry,

        > On my ubuntu build Im getting erratic errors with ncap2 when I set nbr_thd >
        > 4 or if I attempt to time the process e.g   time ncap2 --t 4 -v -O -D 2 -S ncap13.in
        > in.nc foo.nc.

        I wouldn't worry about these.
        GCC OpenMP is brand new and may not be solid yet.
        If it works on the ESMF it's probably good.

        > Daniel It would be great if you could explain to me how to use ddd with threads
        > So I locate the error

        ~two years Daniel showed me how to debug (with DDD) the MPI NCO.
        This code uses the signal handling patches in the mpnc*.c main()'s.
        It is invoked with the -S switch.
        It would be cool/helpful if something similar could be done with
        OpenMP and the nc*.c main()'s.
        ncap uses -S for something else so I suggest a long option, e.g.,
        --signal.

        Charlie

         
    • henry Butowsky

      henry Butowsky - 2007-11-29

      HI Charlie,
      OPENMP now works on Ubuntu and AIX.
      The script ncap2.in runs correctly in parallel mode on both machines.
      There a few corner cases and we will have to rethink the utility functions, set_miss, change_miss, ram_write & ram_delete as these functions can't be executed in parallel. If you need to use them right now then enclose then in a code block.
      So give it a spin !!!

      Regards Henry

       

Log in to post a comment.

MongoDB Logo MongoDB