SConstruct 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # -*- coding: utf-8; mode: Python -*-
  2. # SConstruct for ra/test
  3. # (c) Daniel Llorens - 2015-2024
  4. # This library is free software; you can redistribute it and/or modify it under
  5. # the terms of the GNU Lesser General Public License as published by the Free
  6. # Software Foundation; either version 3 of the License, or (at your option) any
  7. # later version.
  8. # FIXME Shared pieces with {examples,bench,docs}/SConstruct
  9. import os, string, atexit
  10. from os.path import join, abspath
  11. import imp
  12. ra = imp.load_source('ra', '../config/ra.py')
  13. # FIXME pick BLAS flags from here.
  14. try:
  15. Import('top')
  16. except:
  17. top = {}
  18. vars = Variables()
  19. vars.AddVariables(PathVariable('variant_dir', 'build directory', '.', PathVariable.PathIsDirCreate))
  20. env = Environment(options=vars,
  21. ENV=dict([(k, os.environ[k] if k in os.environ else '')
  22. for k in ['PATH', 'HOME', 'TERM', 'LD_RUN_PATH', 'DYLD_LIBRARY_PATH',
  23. 'RPATH', 'LIBRARY_PATH', 'TEXINPUTS', 'GCC_COLORS', 'BOOST_ROOT',
  24. 'RA_USE_BLAS']]))
  25. variant_dir = env['variant_dir']
  26. for var, default in [('CC', 'gcc'), ('CXX', 'g++'), ('FORTRAN', 'gfortran')]:
  27. ra.take_from_environ(env, var, default=default)
  28. for var in ['FORTRANFLAGS', 'LINKFLAGS', 'CCFLAGS', 'CXXFLAGS']:
  29. ra.take_from_environ(env, var, wrapper=lambda x: x.split())
  30. for var in ['RPATH', 'LIBPATH']:
  31. ra.take_from_environ(env, var, wrapper=lambda x: [x])
  32. arch = os.popen('../config/config.guess').read()
  33. cppcomp = os.popen('%s --version' % env['CXX']).read()
  34. if (arch.find('apple-darwin') >= 0) and (cppcomp.find('g++') >= 0):
  35. archflags=['-march=native', '-Wa,-q']
  36. else:
  37. archflags=['-march=native']
  38. env.Prepend(CPPPATH=['..', '.'],
  39. CCFLAGS=archflags if str(env['CCFLAGS']).strip()=='' else '',
  40. CXXFLAGS=ra.CXXFLAGS,
  41. LINKFLAGS=ra.LINKFLAGS)
  42. tester = ra.to_test_ra(env, variant_dir)
  43. [tester(test)
  44. for test in ['at', 'bench', 'big-0', 'big-1', 'bug83', 'cellrank', 'checks', 'compatibility',
  45. 'concrete', 'const', 'constexpr', 'dual', 'explode-0', 'foreign', 'frame-new',
  46. 'frame-old', 'fromb', 'fromu', 'headers', 'io', 'iota', 'iterator-small', 'len',
  47. 'list9', 'macros', 'mem-fn', 'ndebug', 'nested-0', 'old', 'operators', 'optimize',
  48. 'owned', 'ownership', 'ply', 'ra-0', 'ra-1', 'ra-10', 'ra-11', 'ra-12', 'ra-13',
  49. 'ra-14', 'ra-15', 'ra-2', 'ra-3', 'ra-4', 'ra-5', 'ra-6', 'ra-7', 'ra-8',
  50. 'ra-9', 'ra-dual', 'reduction', 'reduction-1', 'reexported', 'reshape', 'return-expr',
  51. 'self-assign', 'sizeof', 'small-0', 'small-1', 'stl-compat', 'swap', 'tensorindex',
  52. 'test', 'tuples', 'types', 'vector-array', 'view-ops', 'wedge', 'where', 'wrank',
  53. # 'bug90745', # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90745 gcc 9-10.2 so far
  54. # 'end'
  55. # 'ra-16' # FIXME broken on gcc11, ok on gcc12/13
  56. ]]
  57. tester('early', target='early-no-su', cppdefines={'RA_STATIC_UNROLL': '0'})
  58. tester('early', target='early-su', cppdefines={'RA_STATIC_UNROLL': '1'})
  59. tester('ra-10', target='ra-10a', cxxflags=['-O3'], cppdefines={'RA_DO_CHECK': '0'})
  60. tester('ra-10', target='ra-10b', cxxflags=['-O1'], cppdefines={'RA_DO_CHECK': '0'})
  61. tester('ra-10', target='ra-10c', cxxflags=['-O3'], cppdefines={'RA_DO_CHECK': '1'})
  62. tester('ra-10', target='ra-10d', cxxflags=['-O1'], cppdefines={'RA_DO_CHECK': '1'})
  63. if 'skip_summary' not in top:
  64. atexit.register(lambda: ra.print_summary(GetBuildFailures, 'ra/test'))