Skip to content

Commit

Permalink
Merge branch 'main' into additions
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrudPrimrose authored Nov 21, 2024
2 parents a7ab6c3 + 4f8eb92 commit cac7515
Show file tree
Hide file tree
Showing 190 changed files with 7,191 additions and 1,800 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/fpga-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ name: FPGA Tests

on:
push:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]
pull_request:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]
merge_group:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]

env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

jobs:
test-fpga:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-ci') }}
runs-on: [self-hosted, linux, intel-fpga, xilinx-fpga]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install dependencies
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/general-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: General Tests

on:
push:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]
pull_request:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]
merge_group:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]

jobs:
test:
Expand All @@ -18,11 +18,11 @@ jobs:
simplify: [0,1,autoopt]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
else
export DACE_optimizer_automatic_simplification=${{ matrix.simplify }}
fi
pytest -n auto --cov-report=xml --cov=dace --tb=short -m "not gpu and not verilator and not tensorflow and not mkl and not sve and not papi and not mlir and not lapack and not fpga and not mpi and not rtl_hardware and not scalapack and not datainstrument"
pytest -n auto --cov-report=xml --cov=dace --tb=short -m "not gpu and not verilator and not tensorflow and not mkl and not sve and not papi and not mlir and not lapack and not fpga and not mpi and not rtl_hardware and not scalapack and not datainstrument and not long"
./codecov
- name: Test OpenBLAS LAPACK
Expand Down Expand Up @@ -85,4 +85,8 @@ jobs:
./tests/polybench_test.sh
./tests/xform_test.sh
coverage combine .; coverage report; coverage xml
./codecov
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
9 changes: 5 additions & 4 deletions .github/workflows/gpu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@ name: GPU Tests

on:
push:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]
pull_request:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]
merge_group:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]

env:
CUDACXX: /usr/local/cuda/bin/nvcc
MKLROOT: /opt/intel/oneapi/mkl/latest/
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}


jobs:
test-gpu:
if: "!contains(github.event.pull_request.labels.*.name, 'no-ci')"
runs-on: [self-hosted, gpu]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hardware_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test-rtl:
runs-on: [self-hosted, linux, xilinx-fpga]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install dependencies
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/heterogeneous-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@ name: Heterogeneous Tests

on:
push:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]
pull_request:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]
merge_group:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]

env:
CUDA_HOME: /usr/local/cuda
CUDACXX: nvcc
MKLROOT: /opt/intel/oneapi/mkl/latest/
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

jobs:
test-heterogeneous:
if: "!contains(github.event.pull_request.labels.*.name, 'no-ci')"
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install dependencies
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/pyFV3-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: NASA/NOAA pyFV3 repository build test

on:
push:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]
pull_request:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]
merge_group:
branches: [ master, ci-fix ]
branches: [ main, ci-fix ]

defaults:
run:
Expand All @@ -21,18 +21,18 @@ jobs:
python-version: [3.11.7]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'NOAA-GFDL/PyFV3'
ref: 'ci/DaCe'
submodules: 'recursive'
path: 'pyFV3'
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: 'dace'
submodules: 'recursive'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install library dependencies
Expand All @@ -53,11 +53,11 @@ jobs:
cd pyFV3
mkdir -p test_data
cd test_data
wget https://portal.nccs.nasa.gov/datashare/astg/smt/pace-regression-data/8.1.3_c12_6ranks_standard.D_SW.tar.gz
wget --retry-connrefused https://portal.nccs.nasa.gov/datashare/astg/smt/pace-regression-data/8.1.3_c12_6ranks_standard.D_SW.tar.gz
tar -xzvf 8.1.3_c12_6ranks_standard.D_SW.tar.gz
wget https://portal.nccs.nasa.gov/datashare/astg/smt/pace-regression-data/8.1.3_c12_6ranks_standard.RiemSolver3.tar.gz
wget --retry-connrefused https://portal.nccs.nasa.gov/datashare/astg/smt/pace-regression-data/8.1.3_c12_6ranks_standard.RiemSolver3.tar.gz
tar -xzvf 8.1.3_c12_6ranks_standard.RiemSolver3.tar.gz
wget https://portal.nccs.nasa.gov/datashare/astg/smt/pace-regression-data/8.1.3_c12_6ranks_standard.Remapping.tar.gz
wget --retry-connrefused https://portal.nccs.nasa.gov/datashare/astg/smt/pace-regression-data/8.1.3_c12_6ranks_standard.Remapping.tar.gz
tar -xzvf 8.1.3_c12_6ranks_standard.Remapping.tar.gz
cd ../..
# Clean up caches between run for stale un-expanded SDFG to trip the build system (NDSL side issue)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/verilator_compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
steps:
- name: trigger reason
run: echo "Trigger Reason:" ${{ github.event.inputs.reason }}
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: checkout submodules
run: git submodule update --init --recursive
- name: install apt packages
run: sudo apt-get update && sudo apt-get -y install git make autoconf g++ flex bison libfl2 libfl-dev
- name: compile verilator
run: git clone https://github.com/verilator/verilator.git && cd verilator && git fetch origin && if [ ! "${{ matrix.verilator_version }}" == "master" ]; then git checkout v${{ matrix.verilator_version }}; fi && autoconf && ./configure && make -j2 && sudo make install
- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: '3.8'
architecture: 'x64'
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ For automatic styling, we use the [yapf](https://github.com/google/yapf) file fo
We use [pytest](https://www.pytest.org/) for our testing infrastructure. All tests under the `tests/` folder
(and any subfolders within) are automatically read and run. The files must be under the right subfolder
based on the component being tested (e.g., `tests/sdfg/` for IR-related tests), and must have the right
suffix: either `*_test.py` or `*_cudatest.py`. See [pytest.ini](https://github.com/spcl/dace/blob/master/pytest.ini)
suffix: either `*_test.py` or `*_cudatest.py`. See [pytest.ini](https://github.com/spcl/dace/blob/main/pytest.ini)
for more information, and for the markers we use to specify software/hardware requirements.

The structure of the test file must follow `pytest` standards (i.e., free functions called `test_*`), and
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
[![FPGA Tests](https://github.com/spcl/dace/actions/workflows/fpga-ci.yml/badge.svg)](https://github.com/spcl/dace/actions/workflows/fpga-ci.yml)
[![Documentation Status](https://readthedocs.org/projects/spcldace/badge/?version=latest)](https://spcldace.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/dace.svg)](https://badge.fury.io/py/dace)
[![codecov](https://codecov.io/gh/spcl/dace/branch/master/graph/badge.svg)](https://codecov.io/gh/spcl/dace)
[![codecov](https://codecov.io/gh/spcl/dace/branch/main/graph/badge.svg)](https://codecov.io/gh/spcl/dace)


![D](dace.svg)aCe - Data-Centric Parallel Programming
=====================================================

_Decoupling domain science from performance optimization._

DaCe is a [fast](https://nbviewer.org/github/spcl/dace/blob/master/tutorials/benchmarking.ipynb) parallel programming
DaCe is a [fast](https://nbviewer.org/github/spcl/dace/blob/main/tutorials/benchmarking.ipynb) parallel programming
framework that takes code in Python/NumPy and other programming languages, and maps it to high-performance
**CPU, GPU, and FPGA** programs, which can be optimized to achieve state-of-the-art. Internally, DaCe
uses the Stateful DataFlow multiGraph (SDFG) *data-centric intermediate
Expand Down Expand Up @@ -61,13 +61,13 @@ be used in any C ABI compatible language (C/C++, FORTRAN, etc.).

For more information on how to use DaCe, see the [samples](samples) or tutorials below:

* [Getting Started](https://nbviewer.jupyter.org/github/spcl/dace/blob/master/tutorials/getting_started.ipynb)
* [Benchmarks, Instrumentation, and Performance Comparison with Other Python Compilers](https://nbviewer.jupyter.org/github/spcl/dace/blob/master/tutorials/benchmarking.ipynb)
* [Explicit Dataflow in Python](https://nbviewer.jupyter.org/github/spcl/dace/blob/master/tutorials/explicit.ipynb)
* [NumPy API Reference](https://nbviewer.jupyter.org/github/spcl/dace/blob/master/tutorials/numpy_frontend.ipynb)
* [SDFG API](https://nbviewer.jupyter.org/github/spcl/dace/blob/master/tutorials/sdfg_api.ipynb)
* [Using and Creating Transformations](https://nbviewer.jupyter.org/github/spcl/dace/blob/master/tutorials/transformations.ipynb)
* [Extending the Code Generator](https://nbviewer.jupyter.org/github/spcl/dace/blob/master/tutorials/codegen.ipynb)
* [Getting Started](https://nbviewer.jupyter.org/github/spcl/dace/blob/main/tutorials/getting_started.ipynb)
* [Benchmarks, Instrumentation, and Performance Comparison with Other Python Compilers](https://nbviewer.jupyter.org/github/spcl/dace/blob/main/tutorials/benchmarking.ipynb)
* [Explicit Dataflow in Python](https://nbviewer.jupyter.org/github/spcl/dace/blob/main/tutorials/explicit.ipynb)
* [NumPy API Reference](https://nbviewer.jupyter.org/github/spcl/dace/blob/main/tutorials/numpy_frontend.ipynb)
* [SDFG API](https://nbviewer.jupyter.org/github/spcl/dace/blob/main/tutorials/sdfg_api.ipynb)
* [Using and Creating Transformations](https://nbviewer.jupyter.org/github/spcl/dace/blob/main/tutorials/transformations.ipynb)
* [Extending the Code Generator](https://nbviewer.jupyter.org/github/spcl/dace/blob/main/tutorials/codegen.ipynb)

Publication
-----------
Expand Down
5 changes: 0 additions & 5 deletions dace/cli/dacelab.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.

import argparse
import numpy
import pickle
import json

import dace
from dace.frontend.octave import parse
from dace.sdfg.nodes import AccessNode

Expand Down
12 changes: 10 additions & 2 deletions dace/cli/sdfg_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import os
import platform
import tempfile
from typing import Dict, Literal, Set, Tuple, Union
from typing import Dict, Set, Tuple, Union
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal

import jinja2
import dace
from dace import memlet as mlt
from dace.sdfg import nodes as nd
Expand Down Expand Up @@ -179,6 +182,11 @@ def main():
diff_sets = _sdfg_diff(sdfg_A, sdfg_B, eq_strategy)

if args.graphical:
try:
import jinja2
except (ImportError, ModuleNotFoundError):
raise ImportError('Graphical SDFG diff requires jinja2, please install by running `pip install jinja2`')

basepath = os.path.join(os.path.dirname(os.path.realpath(dace.__file__)), 'viewer')
template_loader = jinja2.FileSystemLoader(searchpath=os.path.join(basepath, 'templates'))
template_env = jinja2.Environment(loader=template_loader)
Expand Down
2 changes: 1 addition & 1 deletion dace/cli/sdfgcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def main():
sdfg = SDFGOptimizer(sdfg).optimize()

# Compile SDFG
sdfg.compile(outpath)
sdfg.compile(outpath, return_program_handle=False)

# Copying header file to optional path
if outpath is not None:
Expand Down
12 changes: 10 additions & 2 deletions dace/cli/sdfv.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import dace
import tempfile
import jinja2


def partialclass(cls, *args, **kwds):
Expand Down Expand Up @@ -44,10 +43,19 @@ def view(sdfg: dace.SDFG, filename: Optional[Union[str, int]] = None, verbose: b
):
fd, filename = tempfile.mkstemp(suffix='.sdfg')
sdfg.save(filename)
os.system(f'code {filename}')
if platform.system() == 'Darwin':
# Special case for MacOS
os.system(f'open {filename}')
else:
os.system(f'code {filename}')
os.close(fd)
return

try:
import jinja2
except (ImportError, ModuleNotFoundError):
raise ImportError('SDFG.view() requires jinja2, please install by running `pip install jinja2`')

if type(sdfg) is dace.SDFG:
sdfg = dace.serialize.dumps(sdfg.to_json())

Expand Down
7 changes: 6 additions & 1 deletion dace/codegen/compiled_sdfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ def _construct_args(self, kwargs) -> Tuple[Tuple[Any], Tuple[Any]]:
# Otherwise, None values are passed as null pointers below
elif isinstance(arg, ctypes._Pointer):
pass
elif isinstance(arg, str):
# Cast to bytes
arglist[i] = ctypes.c_char_p(arg.encode('utf-8'))
else:
raise TypeError(f'Passing an object (type {type(arg).__name__}) to an array in argument "{a}"')
elif is_array and not is_dtArray:
Expand Down Expand Up @@ -550,6 +553,8 @@ def _construct_args(self, kwargs) -> Tuple[Tuple[Any], Tuple[Any]]:
pass
elif isinstance(arg, float) and atype.dtype.type == np.float64:
pass
elif isinstance(arg, bool) and atype.dtype.type == np.bool_:
pass
elif (isinstance(arg, str) or arg is None) and atype.dtype == dtypes.string:
if arg is None:
arglist[i] = ctypes.c_char_p(None)
Expand All @@ -575,7 +580,7 @@ def _construct_args(self, kwargs) -> Tuple[Tuple[Any], Tuple[Any]]:
arg_ctypes = tuple(at.dtype.as_ctypes() for at in argtypes)

constants = self.sdfg.constants
callparams = tuple((actype(arg.get()) if isinstance(arg, symbolic.symbol) else arg, actype, atype, aname)
callparams = tuple((arg, actype, atype, aname)
for arg, actype, atype, aname in zip(arglist, arg_ctypes, argtypes, argnames)
if not (symbolic.issymbolic(arg) and (hasattr(arg, 'name') and arg.name in constants)))

Expand Down
Loading

0 comments on commit cac7515

Please sign in to comment.