[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: serial vs parallel for ar
From: |
PATTON, BILLY \(SBCSI\) |
Subject: |
RE: serial vs parallel for ar |
Date: |
Thu, 18 May 2006 10:50:27 -0500 |
Problem solved with external script. It may have problems later but for
now it works just fine.
At least for a first pass it is working ok.
Her it is if anyone else wants it :
#!/usr/local/bin/perl
use strict;
use warnings;
use Carp;
########################################################################
# Purpose : To allow multiple processes to write to a .a file at
# the same time. This is done using flock and opening the
# file in append mode and attempting to lock it.
# Author : Billy N. Patton
# Original : 18MAY2006
# Input : archive path (.a) and file to be archived (.o)
# Notes :
# Changes :
#######################################################################
my $arch = $ARGV[0];
my $doto = $ARGV[1];
my $usage = "Usage : $0 /path/file.a /path/file.o\n";
my $LOCK_SH = 1; # shared lock
my $LOCK_EX = 2; # exclusive lock
my $LOCK_NB = 4; #
my $LOCK_UN = 8; # unlock
croak $usage unless defined $arch;
croak $usage unless defined $doto;
`ar cr $arch` unless -f $arch;
open OUT , ">>$arch";
flock OUT , $LOCK_EX;
`/usr/bin/ar rvu $arch $doto`;
flock OUT , $LOCK_UN;
close OUT;
> -----Original Message-----
> From: Paul Smith [mailto:address@hidden On Behalf Of Paul D. Smith
> Sent: Thursday, May 18, 2006 10:12 AM
> To: PATTON, BILLY (SBCSI)
> Cc: address@hidden
> Subject: RE: serial vs parallel for ar
>
>
> %% "PATTON, BILLY \(SBCSI\)" <address@hidden> writes:
>
> pb> Here is the skeleton of what I'm doing
> pb> # create a .a file empty
> pb> AR_CREATE = if [ ! -f
> $(PRD_TREE)/$(1)/$(2)/lib/lib$(2).a ] ; then \
> pb> $(AR) $(AR_CREATE_OPT)
> pb> $(PRD_TREE)/$(1)/$(2)/lib/lib$(2).a ; \
> pb> $$(CHMOD)
> $(PRD_TREE)/$(1)/$(2)/lib/lib$(2).a ; \
> pb> fi
>
> pb> # add a file to a archive
> pb> AR_ADD = $(NM) $@ | grep "main.*extern|entry.*CODE" >
> /dev/null ; \
> pb> if [ $$? -ne 0 ] ; then $(AR) $(AR_OPT) $(LIB)
> $@ > /dev/null ;
> pb> fi
>
> pb> # short hand to create dependencies
> pb> MKDEP = $(MAKEDEPEND) -proj $(1) -bb $(2) -ifile $$< $$(INCLUDE)
>
> pb> # compile .c files to .o
> pb> COMP_CC = @$$(CC) $$(CCFLAGS) $$(INCLUDE) -o $$@ -c $$< ; \
> pb> $(MKDEP) ; $(AR_CREATE); $$(AR_ADD)
>
> I don't understand why you want to put .o's into the archive one at a
> time. Why not do it the same way the linker does, and have only one
> invocation of "ar"? That is the easy way to make sure you don't have
> conflicts even with -j, and it will even be more efficient since you
> have only one invocation of ar instead of one per .o.
>
> --
> --------------------------------------------------------------
> -----------------
> Paul D. Smith <address@hidden> Find some GNU make tips at:
> http://www.gnu.org http://make.paulandlesley.org
> "Please remain calm...I may be mad, but I am a
> professional." --Mad Scientist
>
- RE: serial vs parallel for ar, (continued)
- RE: serial vs parallel for ar, Paul D. Smith, 2006/05/18
- Re: serial vs parallel for ar, Alexey Neyman, 2006/05/18
- Re: serial vs parallel for ar, Alexey Neyman, 2006/05/18
- Re: serial vs parallel for ar, David Boyce, 2006/05/18
- RE: serial vs parallel for ar, PATTON, BILLY \(SBCSI\), 2006/05/18
Re: serial vs parallel for ar, Paul D. Smith, 2006/05/18
- RE: serial vs parallel for ar, PATTON, BILLY \(SBCSI\), 2006/05/18
- RE: serial vs parallel for ar, Paul D. Smith, 2006/05/18
- RE: serial vs parallel for ar, PATTON, BILLY \(SBCSI\), 2006/05/18
- RE: serial vs parallel for ar, Paul D. Smith, 2006/05/18
- RE: serial vs parallel for ar,
PATTON, BILLY \(SBCSI\) <=
- RE: serial vs parallel for ar, Paul D. Smith, 2006/05/18
RE: serial vs parallel for ar, Cesar Crusius, 2006/05/19