@@ -4,21 +4,27 @@ A tensor implementation following the [array API as defined by the data-API cons
44It supports a controller-worker execution model as well as a CSP-like execution.
55
66## Setting up build environment
7- ``` bash
7+ Install MLIR/LLVM and IMEX from branch refactor (see https://github.com/intel/mlir-extensions/tree/refactor ).
8+ ``` bash
89git --recurse-submodules clone https://github.com/intel-sandbox/personal.fschlimb.ddptensor
910cd personal.fschlimb.ddptensor
1011conda env create -f conda-env.yml -n ddpt
1112conda activate ddpt
1213export MPIROOT=$CONDA_PREFIX
1314export MKLROOT=$CONDA_PREFIX
15+ export MLIRROOT=< your-MLIR-install-dir>
16+ export IMEXROOT=< your-IMEX-install-dir>
1417```
1518## Building ddptensor
16- ``` bash
17- CC=gcc-9 CXX=g++-9 CMAKE_BUILD_PARALLEL_LEVEL=8 python setup.py develop
19+ ``` bash
20+ python setup.py develop
1821```
22+ If your compiler does not default to a recent version, try something like ` CC=gcc-9 CXX=g++-9 python setup.py develop `
1923
2024## Running Tests
21- ``` bash
25+ __ Test are currently not operational on this branch.__
26+
27+ ``` bash
2228# single rank
2329pytest test
2430# multiple ranks, controller-worker, controller spawns ranks
@@ -28,3 +34,27 @@ mpirun -n $N python -m pytest test
2834# multiple ranks, CSP
2935DDPT_CW=0 mpirun -n $N python -m pytest test
3036```
37+
38+ ## Running
39+ ``` python
40+ import ddptensor as dt
41+ dt.init(False )
42+ a = dt.arange(0 , 10 , 1 , dt.int64)
43+ # print(a) # should trigger compilation
44+ b = dt.arange(0 , 100 , 10 , dt.int64)
45+ # print(b.dtype) # should _not_ trigger compilation
46+ c = a * b
47+ # print(c)
48+ d = dt.sum(c, [0 ])
49+ # del b # generated function should _not_ return b
50+ print (a, c, d) # printing of c (not a!) should trigger compilation
51+ dt.fini()
52+ ```
53+ Assuming the above is in file ` simple.py ` a single-process run is executed like
54+ ``` bash
55+ python DDPT_IDTR_SO=` pwd` /ddptensor/libidtr.so python simple.py
56+ ```
57+ and multi-process run is executed like
58+ ``` bash
59+ python DDPT_IDTR_SO=` pwd` /ddptensor/libidtr.so mpirun -n 5 python simple.py
60+ ```
0 commit comments