~ubuntu-branches/ubuntu/vivid/atlas/vivid

« back to all changes in this revision

Viewing changes to src/threads/ATL_dyntlaunch.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot, Sylvestre Ledru, Sébastien Villemot
  • Date: 2013-06-11 15:58:16 UTC
  • mfrom: (1.1.4) (25 sid)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: package-import@ubuntu.com-20130611155816-8xeeiziu1iml040c
Tags: 3.10.1-1
[ Sylvestre Ledru ]
* New upstream release (Closes: #609287)

[ Sébastien Villemot ]
* Provide architectural defaults (i.e. precomputed timings) for all
  release archs (except armel and mips for the time being, due to slow
  porterboxes). This will make the package build much faster and should
  eliminate transient build failures due to excessive variance in the
  timings.
* Move symlinks for lib{cblas,f77blas,atlas,lapack_atlas} out of the
  libblas.so.3 alternative and make them always present, so that
  software relying on these libs do not break when another alternative
  is selected for BLAS
* ATLAS now has improved ARM support with native asm constructs. This required
  the following tunes:
  + armel-is-v4t.diff: new patch, prevents FTBFS on armel; otherwise,
    ATLAS uses asm constructs too recent for the platform (armel is only v4t)
  + debian/rules: on armhf, define the ATL_ARM_HARDFP flag; otherwise the asm
    constructs use the soft-float ABI for passing floating points
  + on armhf, ensure that -mfloat-abi=softfp and -mcpu=vfpv3 flags are never
    used; this is implemented via a patch (armhf.diff) and by the use of fixed
    archdefs
* The generic package is now built without multi-threading, because otherwise
  the package fails to build on some single-processor machines (this required
  the introduction of a patch: fix-non-threaded-build.diff). As a side effect,
  the build of the custom package gracefully handles non-threaded
  builds. (Closes: #602524)
* Add libblas.a as slave in the libblas.so alternative (Closes: #701921)
* Add symlinks for lib{f77blas,atlas}.a in /usr/lib (Closes: #666203)
* Modify shlibs file of libatlas3-base, such that packages using
  libblas/liblapack depend on any BLAS/LAPACK alternative, while packages
  depending on ATLAS-specific libraries (e.g. libatlas.so) depend specifically
  on libatlas3-base.
* corei1.diff: remove patch, applied upstream
* Use my @debian.org email address
* Remove obsolete DM-Upload-Allowed flag
* Switch VCS to git
* Remove Conflicts/Replaces against pre-squeeze packages
* libatlas-base-dev now provides libblas.so, as libblas-dev
* No longer use -Wa,--noexecstack in CFLAGS, it makes the package FTBFS
* Do not use POWER3 arch for powerpcspe port (Closes: #701068)
* Bump to debhelper compat level 9
* README.Debian: mention that devscripts is needed to compile the custom
  package (Closes: #697431)
* Bump Standards-Version to 3.9.4. As a consequence, add Built-Using
  fields because the package embeds stuff from liblapack-pic

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef ATL_NOAFFINITY
 
2
   #include "atlas_taffinity.h"  /* include this file first! */
 
3
#endif
 
4
#include "atlas_misc.h"
 
5
#include "atlas_threads.h"
 
6
 
 
7
#if !defined(ATL_NOAFFINITY) && defined(ATL_PAFF_SELF)
 
8
static int ATL_setmyaffinity(ATL_thread_t *me)
 
9
/*
 
10
 * Attempts to sets the affinity of an already-running thread.  The
 
11
 * aff_set flag is set to true whether we succeed or not (no point in
 
12
 * trying multiple times).
 
13
 * RETURNS: 0 on success, non-zero error code on error
 
14
 */
 
15
{
 
16
   #ifdef ATL_RANK_IS_PROCESSORID
 
17
      const int bindID = me->rank % ATL_AFF_NUMID;
 
18
   #else
 
19
      const int bindID = ATL_affinityIDs[me->rank%ATL_AFF_NUMID];
 
20
   #endif
 
21
#ifdef ATL_PAFF_PLPA
 
22
   plpa_cpu_set_t cpuset;
 
23
   PLPA_CPU_ZERO(&cpuset);
 
24
   PLPA_CPU_SET(bindID, &cpuset);
 
25
   if (me->paff_set)
 
26
      return(0);
 
27
   me->paff_set = 1;
 
28
   return(plpa_sched_setaffinity((pid_t)0, sizeof(cpuset), &cpuset));
 
29
#elif defined(ATL_PAFF_PBIND)
 
30
   return(processor_bind(P_LWPID, P_MYID, bindID, NULL));
 
31
#elif defined(ATL_PAFF_SCHED)
 
32
   cpu_set_t cpuset;
 
33
   CPU_ZERO(&cpuset);
 
34
   CPU_SET(bindID, &cpuset);
 
35
   if (me->paff_set)
 
36
      return(0);
 
37
   me->paff_set = 1;
 
38
   return(sched_setaffinity(0, sizeof(cpuset), &cpuset));
 
39
#elif defined (ATL_PAFF_RUNON)
 
40
   if (me->paff_set)
 
41
      return(0);
 
42
   me->paff_set = 1;
 
43
   return(pthread_setrunon_np(bindID));
 
44
#elif defined(ATL_PAFF_BINDP)
 
45
   if (me->paff_set)
 
46
      return(0);
 
47
   me->paff_set = 1;
 
48
   return(bindprocessor(BINDTHREAD, thread_self(), bindID));
 
49
#elif defined(ATL_PAFF_CPUSET)  /* untried FreeBSD code */
 
50
   cpuset_t mycpuset;
 
51
   CPU_ZERO(&mycpuset);         /* no manpage, so guess works like linux */
 
52
   CPU_SET(bindID, &mycpuset);
 
53
   if (me->paff_set)
 
54
      return(0);
 
55
   me->paff_set = 1;
 
56
   return(cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1,
 
57
                             sizeof(mycpuset), &mycpuset));
 
58
#endif
 
59
   return(0);
 
60
}
 
61
#endif
 
62
#if defined(ATL_TUNING) && defined(ATL_NOAFFINITY)
 
63
void *ATL_dyntlaunch_noaff(void *vp)
 
64
#else
 
65
void *ATL_dyntlaunch(void *vp)
 
66
#endif
 
67
{
 
68
   ATL_thread_t *tp = vp, *btp;
 
69
   ATL_LAUNCHSTRUCT_t *lp;
 
70
   const int iam = tp->rank, P = tp->P;
 
71
   int i, src, dest, nthrP2, mask, abit;
 
72
   void *acnt;
 
73
 
 
74
   lp = tp->vp;
 
75
   acnt = lp->acounts[0];
 
76
   btp = tp - iam;
 
77
/*
 
78
 * Set my affinity if I haven't already
 
79
 */
 
80
   #ifdef ATL_PAFF_SELF
 
81
      if (!tp->paff_set)
 
82
          ATL_setmyaffinity(tp);
 
83
   #endif
 
84
   dest = ATL_DecGlobalAtomicCount(acnt, iam);
 
85
   while(dest)
 
86
   {
 
87
      dest = tp->P - dest;
 
88
      ATL_thread_start(btp+dest, dest, 0, ATL_dyntlaunch, btp+dest);
 
89
      dest = ATL_DecGlobalAtomicCount(acnt, iam);
 
90
   }
 
91
/*
 
92
 * Do the operation
 
93
 */
 
94
   lp->DoWork(lp, tp);
 
95
/*
 
96
 * Do combine in minimum spanning tree, combining results as required
 
97
 */
 
98
   for (i=0; (1<<i) < P; i++);
 
99
   nthrP2 = i;
 
100
   mask = 0;
 
101
   for (i=0; i < nthrP2; i++)
 
102
   {
 
103
      if (!(iam & mask))
 
104
      {
 
105
         abit = (1<<i);
 
106
         if (!(iam & abit))
 
107
         {
 
108
            src = iam ^ abit;
 
109
            if (src < P)
 
110
            {
 
111
               while (lp->chkin[src] != ATL_CHK_DONE_OP)
 
112
                  ATL_POLL;
 
113
               if (lp->DoComb)
 
114
                  lp->DoComb(lp->opstruct, iam, src);
 
115
            }
 
116
         }
 
117
         else
 
118
         {
 
119
            lp->chkin[iam] = ATL_CHK_DONE_OP;
 
120
            ATL_thread_exit(NULL);
 
121
         }
 
122
      }
 
123
      mask |= abit;
 
124
   }
 
125
   return(NULL);
 
126
}