Below is a python script that implements the above and sets
environment variables for parallel compiles. Just save the script to
makesage.py (say) in the sage root dir and run it via

python makesage.py -j8

It reduced the sage-4.0.2 compile to 1hour 51 minutes on a dual quad
AMD 2GHz machine.

--------------------------------------------------------------------------------------

import os,sys
import getopt


def replace_install(sj):
    fpin=open('spkg/install',"r")
    sinstall=fpin.readlines()
    fpin.close()

    for iline,sline in enumerate(sinstall):
        if 'time make' in sline and '-f standard/deps $1' in sline:
            sinstall[iline]='time make '+sj+' -f standard/deps $1\n'
    sinstall="".join(sinstall)

    fpou=open('spkg/install',"w")
    fpou.write(sinstall)
    fpou.close()


def main(argv):
    sj='-j1'
    try:
        opts,args=getopt.getopt(argv[1:],"j:")
    except getopt.GetoptError:
        #print_usage()
        sys.exit(1)
    for oo,aa in opts:
        if oo in ("-j"):
            sj="-j"+aa

    smake='make '+sj
    os.environ['MAKE']=smake

    replace_install(sj)

    os.system('export MAKE="%s"'%(smake)+' && make')

    replace_install(sj)

    os.system('export MAKE="%s"'%(smake)+' && make')

    replace_install('')

    os.system('export MAKE="%s"'%(smake)+' && make')



if __name__ == '__main__':
    main(sys.argv)

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to