#12016: parallelism in Sage: just use value of 'MAKE'
---------------------------+------------------------------------------------
   Reporter:  jhpalmieri   |          Owner:  GeorgSWeber                  
       Type:  enhancement  |         Status:  needs_work                   
   Priority:  critical     |      Milestone:  sage-4.8                     
  Component:  build        |       Keywords:                               
Work_issues:               |       Upstream:  N/A                          
   Reviewer:               |         Author:  John Palmieri, Jeroen Demeyer
     Merged:               |   Dependencies:  sage-4.8.alpha3 + #12096     
---------------------------+------------------------------------------------

Comment(by jhpalmieri):

 I installed these patches on sage.math and set `MAKE='make -j12'`.  Then I
 ran `make ptestlong`, and the log file for the testing says "Doctesting
 2857 files doing 2 jobs in parallel".  Running `./sage -tp --long ...`
 uses 12 threads, as it should.

 If I remove the redirection of stderr to null in sage-env, when calling
 sage-num-threads, I see this:
 {{{
 Traceback (most recent call last):
   File "/mnt/usb1/scratch/palmieri/12016/test1/sage-4.8.X/local/bin/sage-
 num-threads.py", line 144, in <module>
     print "%i %i %i"%num_threads()
   File "/mnt/usb1/scratch/palmieri/12016/test1/sage-4.8.X/local/bin/sage-
 num-threads.py", line 95, in num_threads
     if MAKEFLAGS[0] != '-':
 IndexError: string index out of range
 }}}
 This seems to fix the problem for me:
 {{{
 #!diff
 diff --git a/sage-num-threads.py b/sage-num-threads.py
 --- a/sage-num-threads.py
 +++ b/sage-num-threads.py
 @@ -92,7 +92,7 @@ def num_threads():
      try:
          # Prepend hyphen to MAKEFLAGS if it does not start with one
          MAKEFLAGS=os.environ["MAKEFLAGS"]
 -        if MAKEFLAGS[0] != '-':
 +        if len(MAKEFLAGS) > 0 and MAKEFLAGS[0] != '-':
              MAKEFLAGS = '-' + MAKEFLAGS
          # In MAKEFLAGS, "-j" does not mean unlimited.  It probably
          # means an inherited number of jobs, let us use 2 for safety.
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12016#comment:26>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to