#15045: ATLAS: multiple definition of `ATL_SetAtomicCount'
-------------------------------------------------+-------------------------
       Reporter:  jdemeyer                       |        Owner:
           Type:  defect                         |       Status:
       Priority:  blocker                        |  needs_work
      Component:  packages: standard             |    Milestone:  sage-5.12
       Keywords:                                 |   Resolution:
        Authors:  Volker Braun                   |    Merged in:
Report Upstream:  Reported upstream. No          |    Reviewers:
  feedback yet.                                  |  Work issues:
         Branch:                                 |       Commit:
   Dependencies:                                 |     Stopgaps:
-------------------------------------------------+-------------------------

Comment (by nbruin):

 For [http://sourceforge.net/p/math-atlas/support-requests/907/ atlas issue
 907], the relevant code would be:

 `ATLAS/tune/threads/tune_count.c:242`
 {{{
       if (tmut < tldec*1.02)
       {
          printf("\nNO REAL ADVANTAGE TO ASSEMBLY, FORCING USE OF
 MUTEX\n");
          ATL_assert(!system("make iForceUseMutex"));
       }
 }}}

 Looking at
 `ATLAS/makes/Make.ttune:159`
 {{{
 iFind_atomic_arch :
         if $(MAKE) xprobe_atomic_amd64 ; then \
            cp $(myTHRdir)/ATL_*AtomicCount_arch.c . ; \
            cp $(myTHRdir)/ATL_ResetAtomicCount_amd64.S \
               ATL_ResetAtomicCount_arch.S ; \
            cp $(myTHRdir)/ATL_DecAtomicCount_amd64.S \
               ATL_DecAtomicCount_arch.S ; \
            rm $(BLDdir)/src/threads/atomic.inc ; \
            echo "aobj = ATL_SetAtomicCount_arch.o
 ATL_ResetAtomicCount_amd64.o ATL_DecAtomicCount_amd64.o
 ATL_FreeAtomicCount_arch.o" > $(BLDdir)/src/threads/atomic.inc ;
            .... lines elided ....
         fi
         - rm -f $(BLDdir)/src/threads/lib.grd
         $(MAKE) tlib

 }}}
 `ATLAS/makes/Make.ttune:205`
 {{{
 iForceUseMutex:
         rm $(BLDdir)/src/threads/atomic.inc
         echo "aobj = ATL_SetAtomicCount_mut.o ATL_ResetAtomicCount_mut.o
 ATL_DecAtomicCount_mut.o ATL_FreeAtomicCount_mut.o" >
 $(BLDdir)/src/threads/atomic.inc
 }}}

 The file `atomic.inc` is only touched in `Make.ttune`, always in the style
 above. The file is only used in `ATLAS/makes/Make.thr`, where it is
 included to get `aobj` defined, which is then included in `obj` to build a
 library.

 I suspect the problem is that `make iForceUseMutex` doesn't actually
 rebuild the library, which does happen in `make iFind_atomic_arch`. So,
 when we do
 {{{
 iTune_atomic :
         if $(MAKE) mutcnt ; then \
            if $(MAKE) iFind_atomic_arch ; then \
               $(MAKE) xtune_count ; ./xtune_count -r 1000000 -o yes; \
            fi ; \
         else \
            $(MAKE) iFind_atomic_arch ; \
         fi
 }}}
 hich presumably runs the code in `tune_count.c`, we end up with a built
 library that has the architecture-specific bits in it, but an `aobj` that
 reflects otherwise. Probably, the make system runs into these things
 another time and then tries to include the same definitions another time
 in the library.

 Perhaps just patch the system?

 {{{#!diff
 ATLAS/tune/threads/tune_count.c:244
 -         printf("\nNO REAL ADVANTAGE TO ASSEMBLY, FORCING USE OF
 MUTEX\n");
 -         ATL_assert(!system("make iForceUseMutex"));
 +         printf("\nNO REAL ADVANTAGE TO ASSEMBLY, BUT WE LEAVE IT IN
 ANYWAY\n");
 }}}
 I think there is some hope that this will eliminate the (rare) build
 fails.

--
Ticket URL: <http://trac.sagemath.org/ticket/15045#comment:23>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to