|
| 1 | +#!/usr/bin/env python3 |
| 2 | + |
| 3 | +""" |
| 4 | +
|
| 5 | +Test Matrix Generator |
| 6 | +
|
| 7 | +Generates pairwise test combinations using |
| 8 | +[allpairspy](https://github.com/thombashi/allpairspy). |
| 9 | +
|
| 10 | +## Usage |
| 11 | +
|
| 12 | +```bash |
| 13 | +pip install -U pyyaml allpairspy |
| 14 | +python generate_test_matrix.py |
| 15 | +``` |
| 16 | +
|
| 17 | +It enforces certain contrains. |
| 18 | +
|
| 19 | +""" |
| 20 | +from allpairspy import AllPairs |
| 21 | +import yaml |
| 22 | + |
| 23 | +parameters = [ |
| 24 | + # Favor x86 |
| 25 | + ["x86", "x86", "arm"], |
| 26 | + ["gcc", "llvm", "intel-oneapi-compilers", ], |
| 27 | + ["openmpi", "mpich", "intel-oneapi-mpi"], |
| 28 | + ["openblas", "amdblis", "armpl-gcc", "intel-oneapi-mkl", ], |
| 29 | + ["+shared", "~shared"], |
| 30 | + ["+int64", "~int64"], |
| 31 | + ["~openmp", "+openmp"], |
| 32 | + ["+arpack", "+slepc"], |
| 33 | + ["+mumps", "+superlu-dist", "+strumpack"], |
| 34 | + ["~cuda"], |
| 35 | +] |
| 36 | + |
| 37 | +def is_valid(combo): |
| 38 | + if len(combo) < 4: |
| 39 | + # AllPairs creates partial combinations |
| 40 | + return True |
| 41 | + |
| 42 | + arch, compiler, mpi, math_libs = combo[0], combo[1], combo[2], combo[3] |
| 43 | + |
| 44 | + # Intel packages must all be together and only on x86 |
| 45 | + intel_packages = [compiler == "intel-oneapi-compilers", |
| 46 | + mpi == "intel-oneapi-mpi", |
| 47 | + math_libs == "intel-oneapi-mkl"] |
| 48 | + if any(intel_packages): |
| 49 | + if arch != "x86" or not all(intel_packages): |
| 50 | + return False |
| 51 | + |
| 52 | + # Use ARMPL only with GCC and ARM |
| 53 | + if math_libs == "armpl-gcc" and (compiler != "gcc" or arch != "arm"): |
| 54 | + return False |
| 55 | + |
| 56 | + # On ARM, use armpl-gcc or openblas |
| 57 | + if arch == "arm" and math_libs not in ("armpl-gcc", "openblas"): |
| 58 | + return False |
| 59 | + |
| 60 | + return True |
| 61 | + |
| 62 | +matrix = [] |
| 63 | +for combo in AllPairs(parameters, filter_func=is_valid): |
| 64 | + matrix.append({ |
| 65 | + "arch": combo[0], |
| 66 | + "compiler": combo[1], |
| 67 | + "mpi": combo[2], |
| 68 | + "math-libs": combo[3], |
| 69 | + "shared": combo[4], |
| 70 | + "int": combo[5], |
| 71 | + "openmp": combo[6], |
| 72 | + "eigensolver": combo[7], |
| 73 | + "solver": combo[8], |
| 74 | + "cuda": combo[9], |
| 75 | + }) |
| 76 | + |
| 77 | +print(yaml.dump(matrix, default_flow_style=False, sort_keys=False)) |
0 commit comments