[GE users] Re: [GE dev] How can I set a semaphore?

Tim Harsch harsch1 at llnl.gov
Thu Feb 17 18:32:36 GMT 2005


    [ The following text is in the "iso-8859-1" character set. ]
    [ Your display is set for the "ISO-8859-10" character set.  ]
    [ Some special characters may be displayed incorrectly. ]

That did the trick.

I put the #ifndef code in cl_tcp_framework just as you said and recompiled SGE from source and this is what I got...
-----------------------------------
gcc -DUSING_GCC_2_96 -O3 -Wall -Werror -Wstrict-prototypes -DLINUX -DLINUX86 -DLINUX86_24 -D_GNU_SOURCE -DGETHOSTBYNAME_R6 -DGETHOSTBYADDR_R8  -DHAS_IN_PORT_T -I/vol2/SW/db-4.2.52/lx24-x86/include/ -DTARGET_32BIT -DQCONF_FLATFILE  -DSPOOLING_classic  -DCOMPILE_DC -D__SGE_COMPILE_WITH_GETTEXT__  -D__SGE_NO_USERMAPPING__ -I../common -I../libs -I../libs/uti -I../libs/gdi -I../libs/japi -I../libs/sgeobj -I../libs/cull -I../libs/rmon -I../libs/comm -I../libs/comm/lists -I../libs/sched -I../libs/evc -I../libs/evm -I../libs/mir -I../libs/lck -I../daemons/common -I../daemons/qmaster -I../daemons/execd -I../daemons/schedd -I../clients/common -I. -I/usr/local/j2sdk/latest/include -I/usr/local/j2sdk/latest/include/linux -fPIC -c /home/harsch1/cvs/gridengine/source/libs/comm/cl_tcp_framework.c
/home/harsch1/cvs/gridengine/source/libs/comm/cl_tcp_framework.c:67: syntax error before `typedef'

make: *** [cl_tcp_framework.o] Error 1

not done
-----------------------------------
I then left that code in, and recompiled SGE sources with aimk -D_REENTRANT, and then installed those sources, and then rebuilt my Perl module and tested...  still the same problem!  Argh!

I think now there must be other MT stuff missing from my system, or Grid sources are excluding on my platform.  Should SGE be compiling with _REENTRANT defined and perhaps linking to -lmt or other MT stuff?

[root at bio-e-dev common]# uname -a
Linux bio-e-dev.llnl.gov 2.4.9-e.49enterprise #1 SMP Fri Aug 6 11:32:58 EDT 2004 i686 unknown

I attached the output of running aimk ( without defining -D_REENTRANT ) for your perusal.

----- Original Message ----- 
  From: Shannon V. Davidson 
  To: harsch1 at llnl.gov 
  Sent: Wednesday, February 16, 2005 7:29 PM
  Subject: Re: [GE dev] How can I set a semaphore?


  Tim,

  Thought I would take this offline too, since it's more of a programming question.  See below...

  Tim Harsch wrote:

    This would seem similiar to something Fred had told me in an offline email:

    >http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html#H
    >
    >But the cpan Schedule-DRMAAc Makefile does define _REENTRANT, can you 
    >check if your Makefile defines _REENTRANT too?

    Oddly, my Schedule::DRMAAc Makefile ( which are built from Makefile.PL ), do not contain any references to _REENTRANT.  This level of C programming is a bit deep for me so I'm struggling to figure it out.  It would seem to me though that the problem would lay in the drmaa library, that perhaps it is not defining _REENTRANT when built.  ( just on my OS/platform )

    I'm considering putting a
    #ifdef _REENTRANT
    printf( 'REENTRANT defined at line %d', __LINE__ )
    #endif


  If you want to find out if it's defined, you can try something like:

  #ifndef _REENTRANT
  xxxxxxxxxxxxxxxxxxx
  #endif

  You'll get a syntax error when you compile, if it's not defined.

  BTW, if your OS is not Linux, then the _REENTRANT may not apply at all.  Different OS/platforms handle errno differently.

  Shannon



    in the code at that problem area, and then watch it execute.  However, I don't even know where the output would go.  Perhaps it would be better to make a call to the logger functions ( what would that look like? )....
      ----- Original Message ----- 
      From: Shannon V. Davidson 
      To: dev at gridengine.sunsource.net 
      Sent: Wednesday, February 16, 2005 2:26 PM
      Subject: Re: [GE dev] How can I set a semaphore?


      Tim,

      Most threading environments already provide a per-thread errno to avoid problems such as this.  For instance, /usr/include/bits/errno.h on my Linux system includes the following:


      #  if !defined _LIBC || defined _LIBC_REENTRANT
      /* When using threads, errno is a per-thread value.  */
      #   define errno (*__errno_location ())
      #  endif
      # endif /* !__ASSEMBLER__ */
      #endif /* _ERRNO_H */


      Shannon

      Tim Harsch wrote:

I found this thread:
http://gridengine.sunsource.net/servlets/ReadMsg?msgId=24177&listName=users

It says some stuff about DRMAA always being multi-threaded.  Which reminded
me of some of what was said in the earlier posts...  per Fred:
- The problem you are experiencing seems to be in cl_tcp_framework.c between
lines 451 and 452
i = connect(...);
my_error = errno;

Is there a way I could add a couple of lines around that code that would set
and release a semaphore?   I'm sure this must be done in quite a few other
places in the SGE code, I just don't know what the code would be...

Tim Harsch
Computer Scientist
Lawrence Livermore National Laboratory
(925) 423-1135


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at gridengine.sunsource.net
For additional commands, e-mail: dev-help at gridengine.sunsource.net


  


-- 
___________________________________________

Shannon V. Davidson <svdavidson at swbell.net>
Senior Software Engineer           Raytheon
636-479-7465 office        443-383-0331 fax
___________________________________________

    


-- 
___________________________________________

Shannon V. Davidson <svdavidson at swbell.net>
Senior Software Engineer           Raytheon
636-479-7465 office        443-383-0331 fax
___________________________________________



    [ Part 2: "Attached Text" ]

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at gridengine.sunsource.net
For additional commands, e-mail: users-help at gridengine.sunsource.net



More information about the gridengine-users mailing list