├── .clang-format
├── .flake8
├── .git-blame-ignore-revs
├── .gitattributes
├── .github
├── pull_request_template.md
└── workflows
│ ├── Windows-IntelLLVM_3.26.cmake
│ ├── build_and_run.yml
│ ├── conda-package.yml
│ └── pre-commit.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CMakeLists.txt
├── LICENSE
├── README.md
├── SECURITY.md
├── conda-recipe
├── bld.bat
├── build.sh
└── meta.yaml
├── dpbench
├── CMakeLists.txt
├── __init__.py
├── _version.py
├── benchmarks
│ ├── CMakeLists.txt
│ ├── default
│ │ ├── CMakeLists.txt
│ │ ├── black_scholes
│ │ │ ├── CMakeLists.txt
│ │ │ ├── __init__.py
│ │ │ ├── black_scholes_cupy.py
│ │ │ ├── black_scholes_dpnp.py
│ │ │ ├── black_scholes_initialize.py
│ │ │ ├── black_scholes_numba_cuda.py
│ │ │ ├── black_scholes_numba_dpex_k.py
│ │ │ ├── black_scholes_numba_dpex_n.py
│ │ │ ├── black_scholes_numba_dpex_p.py
│ │ │ ├── black_scholes_numba_mlir_k.py
│ │ │ ├── black_scholes_numba_mlir_n.py
│ │ │ ├── black_scholes_numba_mlir_p.py
│ │ │ ├── black_scholes_numba_n.py
│ │ │ ├── black_scholes_numba_np.py
│ │ │ ├── black_scholes_numba_npr.py
│ │ │ ├── black_scholes_numpy.py
│ │ │ ├── black_scholes_python.py
│ │ │ └── black_scholes_sycl_native_ext
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── __init__.py
│ │ │ │ └── black_scholes_sycl
│ │ │ │ ├── _black_scholes_kernel.hpp
│ │ │ │ └── _black_scholes_sycl.cpp
│ │ ├── dbscan
│ │ │ ├── CMakeLists.txt
│ │ │ ├── __init__.py
│ │ │ ├── dbscan_initialize.py
│ │ │ ├── dbscan_numba_dpex_k.py
│ │ │ ├── dbscan_numba_dpex_p.py
│ │ │ ├── dbscan_numba_n.py
│ │ │ ├── dbscan_numba_npr.py
│ │ │ ├── dbscan_python.py
│ │ │ └── dbscan_sycl_native_ext
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── __init__.py
│ │ │ │ └── dbscan_sycl
│ │ │ │ ├── _dbscan_kernel.hpp
│ │ │ │ └── _dbscan_sycl.cpp
│ │ ├── gpairs
│ │ │ ├── CMakeLists.txt
│ │ │ ├── __init__.py
│ │ │ ├── gpairs_cupy.py
│ │ │ ├── gpairs_dpnp.py
│ │ │ ├── gpairs_initialize.py
│ │ │ ├── gpairs_numba_cuda.py
│ │ │ ├── gpairs_numba_dpex_k.py
│ │ │ ├── gpairs_numba_dpex_p.py
│ │ │ ├── gpairs_numba_n.py
│ │ │ ├── gpairs_numba_npr.py
│ │ │ ├── gpairs_numpy.py
│ │ │ └── gpairs_sycl_native_ext
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── __init__.py
│ │ │ │ └── gpairs_sycl
│ │ │ │ ├── _gpairs_kernel.hpp
│ │ │ │ └── _gpairs_sycl.cpp
│ │ ├── kmeans
│ │ │ ├── CMakeLists.txt
│ │ │ ├── __init__.py
│ │ │ ├── kmeans_initialize.py
│ │ │ ├── kmeans_numba_dpex_k.py
│ │ │ ├── kmeans_numba_dpex_p.py
│ │ │ ├── kmeans_numba_mlir_k.py
│ │ │ ├── kmeans_numba_mlir_p.py
│ │ │ ├── kmeans_numba_n.py
│ │ │ ├── kmeans_numba_npr.py
│ │ │ ├── kmeans_python.py
│ │ │ └── kmeans_sycl_native_ext
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── __init__.py
│ │ │ │ └── kmeans_sycl
│ │ │ │ ├── _kmeans_kernel.hpp
│ │ │ │ └── _kmeans_sycl.cpp
│ │ ├── knn
│ │ │ ├── CMakeLists.txt
│ │ │ ├── __init__.py
│ │ │ ├── knn_initialize.py
│ │ │ ├── knn_numba_cuda.py
│ │ │ ├── knn_numba_dpex_k.py
│ │ │ ├── knn_numba_dpex_p.py
│ │ │ ├── knn_numba_npr.py
│ │ │ ├── knn_python.py
│ │ │ └── knn_sycl_native_ext
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── __init__.py
│ │ │ │ └── knn_sycl
│ │ │ │ ├── _knn_kernel.hpp
│ │ │ │ └── _knn_sycl.cpp
│ │ ├── l2_norm
│ │ │ ├── CMakeLists.txt
│ │ │ ├── __init__.py
│ │ │ ├── l2_norm_cupy.py
│ │ │ ├── l2_norm_dpnp.py
│ │ │ ├── l2_norm_initialize.py
│ │ │ ├── l2_norm_numba_cuda.py
│ │ │ ├── l2_norm_numba_dpex_k.py
│ │ │ ├── l2_norm_numba_dpex_n.py
│ │ │ ├── l2_norm_numba_dpex_p.py
│ │ │ ├── l2_norm_numba_mlir_k.py
│ │ │ ├── l2_norm_numba_mlir_n.py
│ │ │ ├── l2_norm_numba_mlir_p.py
│ │ │ ├── l2_norm_numba_n.py
│ │ │ ├── l2_norm_numba_np.py
│ │ │ ├── l2_norm_numba_npr.py
│ │ │ ├── l2_norm_numpy.py
│ │ │ └── l2_norm_sycl_native_ext
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── __init__.py
│ │ │ │ └── l2_norm_sycl
│ │ │ │ ├── _l2_norm_kernel.hpp
│ │ │ │ └── _l2_norm_sycl.cpp
│ │ ├── pairwise_distance
│ │ │ ├── CMakeLists.txt
│ │ │ ├── __init__.py
│ │ │ ├── pairwise_distance_cupy.py
│ │ │ ├── pairwise_distance_dpnp.py
│ │ │ ├── pairwise_distance_initialize.py
│ │ │ ├── pairwise_distance_numba_cuda.py
│ │ │ ├── pairwise_distance_numba_dpex_k.py
│ │ │ ├── pairwise_distance_numba_dpex_n.py
│ │ │ ├── pairwise_distance_numba_dpex_p.py
│ │ │ ├── pairwise_distance_numba_mlir_k.py
│ │ │ ├── pairwise_distance_numba_mlir_n.py
│ │ │ ├── pairwise_distance_numba_mlir_p.py
│ │ │ ├── pairwise_distance_numba_np.py
│ │ │ ├── pairwise_distance_numba_npr.py
│ │ │ ├── pairwise_distance_numpy.py
│ │ │ └── pairwise_distance_sycl_native_ext
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── __init__.py
│ │ │ │ └── pairwise_distance_sycl
│ │ │ │ ├── _pairwise_distance_kernel.hpp
│ │ │ │ └── _pairwise_distance_sycl.cpp
│ │ ├── pca
│ │ │ ├── __init__.py
│ │ │ ├── pca_cupy.py
│ │ │ ├── pca_dpnp.py
│ │ │ ├── pca_initialize.py
│ │ │ ├── pca_numba_dpex_n.py
│ │ │ ├── pca_numba_n.py
│ │ │ ├── pca_numba_np.py
│ │ │ ├── pca_numpy.py
│ │ │ └── pca_validate.py
│ │ └── rambo
│ │ │ ├── CMakeLists.txt
│ │ │ ├── __init__.py
│ │ │ ├── rambo_cupy.py
│ │ │ ├── rambo_dpnp.py
│ │ │ ├── rambo_initialize.py
│ │ │ ├── rambo_numba_cuda.py
│ │ │ ├── rambo_numba_dpex_k.py
│ │ │ ├── rambo_numba_dpex_n.py
│ │ │ ├── rambo_numba_dpex_p.py
│ │ │ ├── rambo_numba_mlir_k.py
│ │ │ ├── rambo_numba_mlir_n.py
│ │ │ ├── rambo_numba_mlir_p.py
│ │ │ ├── rambo_numba_n.py
│ │ │ ├── rambo_numba_np.py
│ │ │ ├── rambo_numba_npr.py
│ │ │ ├── rambo_numpy.py
│ │ │ ├── rambo_python.py
│ │ │ └── rambo_sycl_native_ext
│ │ │ ├── CMakeLists.txt
│ │ │ ├── __init__.py
│ │ │ └── rambo_sycl
│ │ │ ├── _rambo_kernel.hpp
│ │ │ └── _rambo_sycl.cpp
│ ├── npbench
│ │ ├── azimint_hist
│ │ │ ├── azimint_hist.py
│ │ │ ├── azimint_hist_cupy.py
│ │ │ ├── azimint_hist_dace.py
│ │ │ ├── azimint_hist_dpnp.py
│ │ │ ├── azimint_hist_legate.py
│ │ │ ├── azimint_hist_numba_dpex_n.py
│ │ │ ├── azimint_hist_numba_dpex_p.py
│ │ │ ├── azimint_hist_numba_n.py
│ │ │ ├── azimint_hist_numba_np.py
│ │ │ ├── azimint_hist_numba_npr.py
│ │ │ ├── azimint_hist_numba_o.py
│ │ │ ├── azimint_hist_numba_op.py
│ │ │ ├── azimint_hist_numpy.py
│ │ │ └── azimint_hist_pythran.py
│ │ ├── azimint_naive
│ │ │ ├── azimint_naive.py
│ │ │ ├── azimint_naive_cupy.py
│ │ │ ├── azimint_naive_dace.py
│ │ │ ├── azimint_naive_dpnp.py
│ │ │ ├── azimint_naive_legate.py
│ │ │ ├── azimint_naive_numba_dpex_n.py
│ │ │ ├── azimint_naive_numba_dpex_p.py
│ │ │ ├── azimint_naive_numba_n.py
│ │ │ ├── azimint_naive_numba_np.py
│ │ │ ├── azimint_naive_numba_npr.py
│ │ │ ├── azimint_naive_numpy.py
│ │ │ └── azimint_naive_pythran.py
│ │ ├── cavity_flow
│ │ │ ├── cavity_flow.py
│ │ │ ├── cavity_flow_cupy.py
│ │ │ ├── cavity_flow_dace.py
│ │ │ ├── cavity_flow_dpnp.py
│ │ │ ├── cavity_flow_legate.py
│ │ │ ├── cavity_flow_numba_n.py
│ │ │ ├── cavity_flow_numba_np.py
│ │ │ ├── cavity_flow_numpy.py
│ │ │ └── cavity_flow_pythran.py
│ │ ├── channel_flow
│ │ │ ├── channel_flow.py
│ │ │ ├── channel_flow_cupy.py
│ │ │ ├── channel_flow_dace.py
│ │ │ ├── channel_flow_dpnp.py
│ │ │ ├── channel_flow_numba_dpex_n.py
│ │ │ ├── channel_flow_numba_n.py
│ │ │ ├── channel_flow_numba_np.py
│ │ │ ├── channel_flow_numpy.py
│ │ │ └── channel_flow_pythran.py
│ │ ├── compute
│ │ │ ├── compute.py
│ │ │ ├── compute_cupy.py
│ │ │ ├── compute_dace.py
│ │ │ ├── compute_dpnp.py
│ │ │ ├── compute_legate.py
│ │ │ ├── compute_numba_dpex_n.py
│ │ │ ├── compute_numba_n.py
│ │ │ ├── compute_numba_np.py
│ │ │ ├── compute_numba_o.py
│ │ │ ├── compute_numba_op.py
│ │ │ ├── compute_numpy.py
│ │ │ └── compute_pythran.py
│ │ ├── contour_integral
│ │ │ ├── contour_integral.py
│ │ │ ├── contour_integral_cupy.py
│ │ │ ├── contour_integral_dace.py
│ │ │ ├── contour_integral_dpnp.py
│ │ │ ├── contour_integral_numba_dpex_p.py
│ │ │ ├── contour_integral_numba_n.py
│ │ │ ├── contour_integral_numba_np.py
│ │ │ ├── contour_integral_numba_npr.py
│ │ │ ├── contour_integral_numpy.py
│ │ │ └── contour_integral_pythran.py
│ │ ├── crc16
│ │ │ ├── crc16.py
│ │ │ ├── crc16_cupy.py
│ │ │ ├── crc16_dace.py
│ │ │ ├── crc16_dpnp.py
│ │ │ ├── crc16_numba_dpex_n.py
│ │ │ ├── crc16_numba_n.py
│ │ │ ├── crc16_numba_np.py
│ │ │ ├── crc16_numpy.py
│ │ │ └── crc16_pythran.py
│ │ ├── deep_learning
│ │ │ ├── conv2d_bias
│ │ │ │ ├── conv2d.py
│ │ │ │ ├── conv2d_cupy.py
│ │ │ │ ├── conv2d_dace.py
│ │ │ │ ├── conv2d_dpnp.py
│ │ │ │ ├── conv2d_numba_dpex_n.py
│ │ │ │ ├── conv2d_numba_dpex_p.py
│ │ │ │ ├── conv2d_numba_n.py
│ │ │ │ ├── conv2d_numba_np.py
│ │ │ │ ├── conv2d_numba_npr.py
│ │ │ │ ├── conv2d_numba_o.py
│ │ │ │ ├── conv2d_numba_op.py
│ │ │ │ ├── conv2d_numba_opr.py
│ │ │ │ ├── conv2d_numpy.py
│ │ │ │ └── conv2d_pythran.py
│ │ │ ├── lenet
│ │ │ │ ├── lenet.py
│ │ │ │ ├── lenet_cupy.py
│ │ │ │ ├── lenet_dace.py
│ │ │ │ ├── lenet_dpnp.py
│ │ │ │ ├── lenet_manual.py
│ │ │ │ ├── lenet_numba_dpex_p.py
│ │ │ │ ├── lenet_numba_n.py
│ │ │ │ ├── lenet_numba_np.py
│ │ │ │ ├── lenet_numba_npr.py
│ │ │ │ ├── lenet_numba_o.py
│ │ │ │ ├── lenet_numba_op.py
│ │ │ │ ├── lenet_numba_opr.py
│ │ │ │ ├── lenet_numpy.py
│ │ │ │ └── lenet_pythran.py
│ │ │ ├── mlp
│ │ │ │ ├── mlp.py
│ │ │ │ ├── mlp_cupy.py
│ │ │ │ ├── mlp_dace.py
│ │ │ │ ├── mlp_dpnp.py
│ │ │ │ ├── mlp_numba_dpex_n.py
│ │ │ │ ├── mlp_numba_dpex_p.py
│ │ │ │ ├── mlp_numba_n.py
│ │ │ │ ├── mlp_numba_np.py
│ │ │ │ ├── mlp_numba_npr.py
│ │ │ │ ├── mlp_numba_o.py
│ │ │ │ ├── mlp_numba_op.py
│ │ │ │ ├── mlp_numpy.py
│ │ │ │ └── mlp_pythran.py
│ │ │ ├── resnet
│ │ │ │ ├── resnet.py
│ │ │ │ ├── resnet_cupy.py
│ │ │ │ ├── resnet_dace.py
│ │ │ │ ├── resnet_dpnp.py
│ │ │ │ ├── resnet_numba_dpex_p.py
│ │ │ │ ├── resnet_numba_n.py
│ │ │ │ ├── resnet_numba_np.py
│ │ │ │ ├── resnet_numba_npr.py
│ │ │ │ ├── resnet_numba_o.py
│ │ │ │ ├── resnet_numba_op.py
│ │ │ │ ├── resnet_numba_opr.py
│ │ │ │ ├── resnet_numpy.py
│ │ │ │ └── resnet_pythran.py
│ │ │ └── softmax
│ │ │ │ ├── softmax.py
│ │ │ │ ├── softmax_cupy.py
│ │ │ │ ├── softmax_dace.py
│ │ │ │ ├── softmax_dpnp.py
│ │ │ │ ├── softmax_numba_dpex_n.py
│ │ │ │ ├── softmax_numba_dpex_p.py
│ │ │ │ ├── softmax_numba_n.py
│ │ │ │ ├── softmax_numba_np.py
│ │ │ │ ├── softmax_numba_npr.py
│ │ │ │ ├── softmax_numba_o.py
│ │ │ │ ├── softmax_numba_op.py
│ │ │ │ ├── softmax_numpy.py
│ │ │ │ └── softmax_pythran.py
│ │ ├── go_fast
│ │ │ ├── go_fast.py
│ │ │ ├── go_fast_cupy.py
│ │ │ ├── go_fast_dace.py
│ │ │ ├── go_fast_dpnp.py
│ │ │ ├── go_fast_legate.py
│ │ │ ├── go_fast_numba_dpex_n.py
│ │ │ ├── go_fast_numba_dpex_p.py
│ │ │ ├── go_fast_numba_n.py
│ │ │ ├── go_fast_numba_np.py
│ │ │ ├── go_fast_numba_npr.py
│ │ │ ├── go_fast_numpy.py
│ │ │ └── go_fast_pythran.py
│ │ ├── mandelbrot1
│ │ │ ├── mandelbrot1_cupy.py
│ │ │ ├── mandelbrot1_dace.py
│ │ │ ├── mandelbrot1_dask.py
│ │ │ ├── mandelbrot1_dpnp.py
│ │ │ ├── mandelbrot1_legate.py
│ │ │ ├── mandelbrot1_numba_dpex_n.py
│ │ │ ├── mandelbrot1_numba_dpex_p.py
│ │ │ ├── mandelbrot1_numba_n.py
│ │ │ ├── mandelbrot1_numba_np.py
│ │ │ ├── mandelbrot1_numba_npr.py
│ │ │ ├── mandelbrot1_numba_o.py
│ │ │ ├── mandelbrot1_numba_op.py
│ │ │ ├── mandelbrot1_numpy.py
│ │ │ └── mandelbrot1_pythran.py
│ │ ├── mandelbrot2
│ │ │ ├── mandelbrot2_cupy.py
│ │ │ ├── mandelbrot2_dace.py
│ │ │ ├── mandelbrot2_dpnp.py
│ │ │ ├── mandelbrot2_legate.py
│ │ │ ├── mandelbrot2_numba_n.py
│ │ │ ├── mandelbrot2_numba_o.py
│ │ │ ├── mandelbrot2_numba_op.py
│ │ │ ├── mandelbrot2_numpy.py
│ │ │ └── mandelbrot2_pythran.py
│ │ ├── nbody
│ │ │ ├── nbody.py
│ │ │ ├── nbody_cupy.py
│ │ │ ├── nbody_dace.py
│ │ │ ├── nbody_dpnp.py
│ │ │ ├── nbody_numba_n.py
│ │ │ ├── nbody_numba_o.py
│ │ │ ├── nbody_numba_op.py
│ │ │ ├── nbody_numpy.py
│ │ │ └── nbody_pythran.py
│ │ ├── pythran
│ │ │ └── arc_distance
│ │ │ │ ├── arc_distance.py
│ │ │ │ ├── arc_distance_cupy.py
│ │ │ │ ├── arc_distance_dace.py
│ │ │ │ ├── arc_distance_dpnp.py
│ │ │ │ ├── arc_distance_legate.py
│ │ │ │ ├── arc_distance_numba_dpex_n.py
│ │ │ │ ├── arc_distance_numba_n.py
│ │ │ │ ├── arc_distance_numba_np.py
│ │ │ │ ├── arc_distance_numpy.py
│ │ │ │ └── arc_distance_pythran.py
│ │ ├── scattering_self_energies
│ │ │ ├── scattering_self_energies.py
│ │ │ ├── scattering_self_energies_cupy.py
│ │ │ ├── scattering_self_energies_dace.py
│ │ │ ├── scattering_self_energies_dpnp.py
│ │ │ ├── scattering_self_energies_numba_dpex_p.py
│ │ │ ├── scattering_self_energies_numba_n.py
│ │ │ ├── scattering_self_energies_numba_npr.py
│ │ │ ├── scattering_self_energies_numpy.py
│ │ │ └── scattering_self_energies_pythran.py
│ │ ├── spmv
│ │ │ ├── spmv.py
│ │ │ ├── spmv_cupy.py
│ │ │ ├── spmv_dace.py
│ │ │ ├── spmv_dpnp.py
│ │ │ ├── spmv_numba_dpex_n.py
│ │ │ ├── spmv_numba_dpex_p.py
│ │ │ ├── spmv_numba_n.py
│ │ │ ├── spmv_numba_np.py
│ │ │ ├── spmv_numba_npr.py
│ │ │ ├── spmv_numpy.py
│ │ │ └── spmv_pythran.py
│ │ ├── stockham_fft
│ │ │ ├── stockham_fft.py
│ │ │ ├── stockham_fft_cupy.py
│ │ │ ├── stockham_fft_dace.py
│ │ │ ├── stockham_fft_dpnp.py
│ │ │ ├── stockham_fft_numba_dpex_p.py
│ │ │ ├── stockham_fft_numba_n.py
│ │ │ ├── stockham_fft_numba_np.py
│ │ │ ├── stockham_fft_numba_npr.py
│ │ │ ├── stockham_fft_numba_o.py
│ │ │ ├── stockham_fft_numba_op.py
│ │ │ ├── stockham_fft_numpy.py
│ │ │ └── stockham_fft_pythran.py
│ │ └── weather_stencils
│ │ │ ├── hdiff
│ │ │ ├── hdiff.py
│ │ │ ├── hdiff_cupy.py
│ │ │ ├── hdiff_dace.py
│ │ │ ├── hdiff_dpnp.py
│ │ │ ├── hdiff_numba_dpex_n.py
│ │ │ ├── hdiff_numba_n.py
│ │ │ ├── hdiff_numba_np.py
│ │ │ ├── hdiff_numpy.py
│ │ │ └── hdiff_pythran.py
│ │ │ └── vadv
│ │ │ ├── vadv.py
│ │ │ ├── vadv_cupy.py
│ │ │ ├── vadv_dace.py
│ │ │ ├── vadv_dpnp.py
│ │ │ ├── vadv_numba_dpex_n.py
│ │ │ ├── vadv_numba_n.py
│ │ │ ├── vadv_numba_np.py
│ │ │ ├── vadv_numpy.py
│ │ │ └── vadv_pythran.py
│ ├── polybench
│ │ ├── datamining
│ │ │ ├── correlation
│ │ │ │ ├── correlation.py
│ │ │ │ ├── correlation_cupy.py
│ │ │ │ ├── correlation_dace.py
│ │ │ │ ├── correlation_dpnp.py
│ │ │ │ ├── correlation_legate.py
│ │ │ │ ├── correlation_numba_dpex_p.py
│ │ │ │ ├── correlation_numba_n.py
│ │ │ │ ├── correlation_numba_np.py
│ │ │ │ ├── correlation_numba_npr.py
│ │ │ │ ├── correlation_numba_o.py
│ │ │ │ ├── correlation_numba_op.py
│ │ │ │ ├── correlation_numba_opr.py
│ │ │ │ ├── correlation_numpy.py
│ │ │ │ └── correlation_pythran.py
│ │ │ └── covariance
│ │ │ │ ├── covariance.py
│ │ │ │ ├── covariance_cupy.py
│ │ │ │ ├── covariance_dace.py
│ │ │ │ ├── covariance_dpnp.py
│ │ │ │ ├── covariance_legate.py
│ │ │ │ ├── covariance_numba_dpex_p.py
│ │ │ │ ├── covariance_numba_n.py
│ │ │ │ ├── covariance_numba_np.py
│ │ │ │ ├── covariance_numba_npr.py
│ │ │ │ ├── covariance_numba_o.py
│ │ │ │ ├── covariance_numba_op.py
│ │ │ │ ├── covariance_numba_opr.py
│ │ │ │ ├── covariance_numpy.py
│ │ │ │ └── covariance_pythran.py
│ │ ├── linear-algebra
│ │ │ ├── blas
│ │ │ │ ├── gemm
│ │ │ │ │ ├── gemm.py
│ │ │ │ │ ├── gemm_cupy.py
│ │ │ │ │ ├── gemm_dace.py
│ │ │ │ │ ├── gemm_dpnp.py
│ │ │ │ │ ├── gemm_legate.py
│ │ │ │ │ ├── gemm_numba_dpex_n.py
│ │ │ │ │ ├── gemm_numba_n.py
│ │ │ │ │ ├── gemm_numba_np.py
│ │ │ │ │ ├── gemm_numpy.py
│ │ │ │ │ └── gemm_pythran.py
│ │ │ │ ├── gemver
│ │ │ │ │ ├── gemver.py
│ │ │ │ │ ├── gemver_cupy.py
│ │ │ │ │ ├── gemver_dace.py
│ │ │ │ │ ├── gemver_dpnp.py
│ │ │ │ │ ├── gemver_numba_dpex_n.py
│ │ │ │ │ ├── gemver_numba_n.py
│ │ │ │ │ ├── gemver_numba_np.py
│ │ │ │ │ ├── gemver_numpy.py
│ │ │ │ │ └── gemver_pythran.py
│ │ │ │ ├── gesummv
│ │ │ │ │ ├── gesummv.py
│ │ │ │ │ ├── gesummv_cupy.py
│ │ │ │ │ ├── gesummv_dace.py
│ │ │ │ │ ├── gesummv_dpnp.py
│ │ │ │ │ ├── gesummv_numba_dpex_n.py
│ │ │ │ │ ├── gesummv_numba_n.py
│ │ │ │ │ ├── gesummv_numba_np.py
│ │ │ │ │ ├── gesummv_numpy.py
│ │ │ │ │ └── gesummv_pythran.py
│ │ │ │ ├── symm
│ │ │ │ │ ├── symm.py
│ │ │ │ │ ├── symm_cupy.py
│ │ │ │ │ ├── symm_dace.py
│ │ │ │ │ ├── symm_dpnp.py
│ │ │ │ │ ├── symm_numba_dpex_p.py
│ │ │ │ │ ├── symm_numba_n.py
│ │ │ │ │ ├── symm_numba_npr.py
│ │ │ │ │ ├── symm_numpy.py
│ │ │ │ │ └── symm_pythran.py
│ │ │ │ ├── syr2k
│ │ │ │ │ ├── syr2k.py
│ │ │ │ │ ├── syr2k_cupy.py
│ │ │ │ │ ├── syr2k_dace.py
│ │ │ │ │ ├── syr2k_dpnp.py
│ │ │ │ │ ├── syr2k_numba_n.py
│ │ │ │ │ ├── syr2k_numpy.py
│ │ │ │ │ └── syr2k_pythran.py
│ │ │ │ ├── syrk
│ │ │ │ │ ├── syrk.py
│ │ │ │ │ ├── syrk_cupy.py
│ │ │ │ │ ├── syrk_dace.py
│ │ │ │ │ ├── syrk_dpnp.py
│ │ │ │ │ ├── syrk_numba_n.py
│ │ │ │ │ ├── syrk_numpy.py
│ │ │ │ │ └── syrk_pythran.py
│ │ │ │ └── trmm
│ │ │ │ │ ├── trmm.py
│ │ │ │ │ ├── trmm_cupy.py
│ │ │ │ │ ├── trmm_dace.py
│ │ │ │ │ ├── trmm_dpnp.py
│ │ │ │ │ ├── trmm_numba_dpex_p.py
│ │ │ │ │ ├── trmm_numba_n.py
│ │ │ │ │ ├── trmm_numba_npr.py
│ │ │ │ │ ├── trmm_numpy.py
│ │ │ │ │ └── trmm_pythran.py
│ │ │ ├── kernels
│ │ │ │ ├── atax
│ │ │ │ │ ├── atax.py
│ │ │ │ │ ├── atax_cupy.py
│ │ │ │ │ ├── atax_dace.py
│ │ │ │ │ ├── atax_dpnp.py
│ │ │ │ │ ├── atax_legate.py
│ │ │ │ │ ├── atax_numba_dpex_n.py
│ │ │ │ │ ├── atax_numba_n.py
│ │ │ │ │ ├── atax_numba_np.py
│ │ │ │ │ ├── atax_numpy.py
│ │ │ │ │ └── atax_pythran.py
│ │ │ │ ├── bicg
│ │ │ │ │ ├── bicg.py
│ │ │ │ │ ├── bicg_cupy.py
│ │ │ │ │ ├── bicg_dace.py
│ │ │ │ │ ├── bicg_dpnp.py
│ │ │ │ │ ├── bicg_legate.py
│ │ │ │ │ ├── bicg_numba_dpex_n.py
│ │ │ │ │ ├── bicg_numba_n.py
│ │ │ │ │ ├── bicg_numba_np.py
│ │ │ │ │ ├── bicg_numpy.py
│ │ │ │ │ └── bicg_pythran.py
│ │ │ │ ├── doitgen
│ │ │ │ │ ├── doitgen.py
│ │ │ │ │ ├── doitgen_cupy.py
│ │ │ │ │ ├── doitgen_dace.py
│ │ │ │ │ ├── doitgen_dpnp.py
│ │ │ │ │ ├── doitgen_legate.py
│ │ │ │ │ ├── doitgen_numba_n.py
│ │ │ │ │ ├── doitgen_numba_o.py
│ │ │ │ │ ├── doitgen_numba_op.py
│ │ │ │ │ ├── doitgen_numpy.py
│ │ │ │ │ └── doitgen_pythran.py
│ │ │ │ ├── k2mm
│ │ │ │ │ ├── k2mm.py
│ │ │ │ │ ├── k2mm_cupy.py
│ │ │ │ │ ├── k2mm_dace.py
│ │ │ │ │ ├── k2mm_dpnp.py
│ │ │ │ │ ├── k2mm_legate.py
│ │ │ │ │ ├── k2mm_numba_dpex_n.py
│ │ │ │ │ ├── k2mm_numba_n.py
│ │ │ │ │ ├── k2mm_numba_np.py
│ │ │ │ │ ├── k2mm_numpy.py
│ │ │ │ │ └── k2mm_pythran.py
│ │ │ │ ├── k3mm
│ │ │ │ │ ├── k3mm.py
│ │ │ │ │ ├── k3mm_cupy.py
│ │ │ │ │ ├── k3mm_dace.py
│ │ │ │ │ ├── k3mm_dpnp.py
│ │ │ │ │ ├── k3mm_legate.py
│ │ │ │ │ ├── k3mm_numba_dpex_n.py
│ │ │ │ │ ├── k3mm_numba_n.py
│ │ │ │ │ ├── k3mm_numba_np.py
│ │ │ │ │ ├── k3mm_numpy.py
│ │ │ │ │ └── k3mm_pythran.py
│ │ │ │ └── mvt
│ │ │ │ │ ├── mvt.py
│ │ │ │ │ ├── mvt_cupy.py
│ │ │ │ │ ├── mvt_dace.py
│ │ │ │ │ ├── mvt_dpnp.py
│ │ │ │ │ ├── mvt_numba_dpex_n.py
│ │ │ │ │ ├── mvt_numba_n.py
│ │ │ │ │ ├── mvt_numba_np.py
│ │ │ │ │ ├── mvt_numpy.py
│ │ │ │ │ └── mvt_pythran.py
│ │ │ └── solvers
│ │ │ │ ├── cholesky
│ │ │ │ ├── cholesky.py
│ │ │ │ ├── cholesky_cupy.py
│ │ │ │ ├── cholesky_dace.py
│ │ │ │ ├── cholesky_dpnp.py
│ │ │ │ ├── cholesky_legate.py
│ │ │ │ ├── cholesky_numba_dpex_p.py
│ │ │ │ ├── cholesky_numba_n.py
│ │ │ │ ├── cholesky_numba_npr.py
│ │ │ │ ├── cholesky_numpy.py
│ │ │ │ └── cholesky_pythran.py
│ │ │ │ ├── cholesky2
│ │ │ │ ├── cholesky2.py
│ │ │ │ ├── cholesky2_cupy.py
│ │ │ │ ├── cholesky2_dace.py
│ │ │ │ ├── cholesky2_dpnp.py
│ │ │ │ ├── cholesky2_legate.py
│ │ │ │ ├── cholesky2_numba_dpex_n.py
│ │ │ │ ├── cholesky2_numba_n.py
│ │ │ │ ├── cholesky2_numba_np.py
│ │ │ │ ├── cholesky2_numpy.py
│ │ │ │ └── cholesky2_pythran.py
│ │ │ │ ├── durbin
│ │ │ │ ├── durbin.py
│ │ │ │ ├── durbin_cupy.py
│ │ │ │ ├── durbin_dace.py
│ │ │ │ ├── durbin_dpnp.py
│ │ │ │ ├── durbin_legate.py
│ │ │ │ ├── durbin_numba_n.py
│ │ │ │ ├── durbin_numba_np.py
│ │ │ │ ├── durbin_numpy.py
│ │ │ │ └── durbin_pythran.py
│ │ │ │ ├── gramschmidt
│ │ │ │ ├── gramschmidt.py
│ │ │ │ ├── gramschmidt_cupy.py
│ │ │ │ ├── gramschmidt_dace.py
│ │ │ │ ├── gramschmidt_dpnp.py
│ │ │ │ ├── gramschmidt_numba_dpex_n.py
│ │ │ │ ├── gramschmidt_numba_n.py
│ │ │ │ ├── gramschmidt_numba_np.py
│ │ │ │ ├── gramschmidt_numpy.py
│ │ │ │ └── gramschmidt_pythran.py
│ │ │ │ ├── lu
│ │ │ │ ├── lu.py
│ │ │ │ ├── lu_cupy.py
│ │ │ │ ├── lu_dace.py
│ │ │ │ ├── lu_dpnp.py
│ │ │ │ ├── lu_numba_dpex_n.py
│ │ │ │ ├── lu_numba_n.py
│ │ │ │ ├── lu_numba_np.py
│ │ │ │ ├── lu_numpy.py
│ │ │ │ └── lu_pythran.py
│ │ │ │ ├── ludcmp
│ │ │ │ ├── ludcmp.py
│ │ │ │ ├── ludcmp_cupy.py
│ │ │ │ ├── ludcmp_dace.py
│ │ │ │ ├── ludcmp_dpnp.py
│ │ │ │ ├── ludcmp_numba_dpex_n.py
│ │ │ │ ├── ludcmp_numba_n.py
│ │ │ │ ├── ludcmp_numba_np.py
│ │ │ │ ├── ludcmp_numpy.py
│ │ │ │ └── ludcmp_pythran.py
│ │ │ │ └── trisolv
│ │ │ │ ├── trisolv.py
│ │ │ │ ├── trisolv_cupy.py
│ │ │ │ ├── trisolv_dace.py
│ │ │ │ ├── trisolv_dpnp.py
│ │ │ │ ├── trisolv_numba_dpex_n.py
│ │ │ │ ├── trisolv_numba_n.py
│ │ │ │ ├── trisolv_numba_np.py
│ │ │ │ ├── trisolv_numpy.py
│ │ │ │ └── trisolv_pythran.py
│ │ ├── medley
│ │ │ ├── deriche
│ │ │ │ ├── deriche.py
│ │ │ │ ├── deriche_cupy.py
│ │ │ │ ├── deriche_dace.py
│ │ │ │ ├── deriche_dpnp.py
│ │ │ │ ├── deriche_legate.py
│ │ │ │ ├── deriche_numba_dpex_n.py
│ │ │ │ ├── deriche_numba_n.py
│ │ │ │ ├── deriche_numba_np.py
│ │ │ │ ├── deriche_numpy.py
│ │ │ │ └── deriche_pythran.py
│ │ │ ├── floyd_warshall
│ │ │ │ ├── floyd_warshall.py
│ │ │ │ ├── floyd_warshall_cupy.py
│ │ │ │ ├── floyd_warshall_dace.py
│ │ │ │ ├── floyd_warshall_dpnp.py
│ │ │ │ ├── floyd_warshall_numba_dpex_p.py
│ │ │ │ ├── floyd_warshall_numba_n.py
│ │ │ │ ├── floyd_warshall_numba_np.py
│ │ │ │ ├── floyd_warshall_numba_npr.py
│ │ │ │ ├── floyd_warshall_numba_o.py
│ │ │ │ ├── floyd_warshall_numba_op.py
│ │ │ │ ├── floyd_warshall_numpy.py
│ │ │ │ └── floyd_warshall_pythran.py
│ │ │ └── nussinov
│ │ │ │ ├── nussinov.py
│ │ │ │ ├── nussinov_cupy.py
│ │ │ │ ├── nussinov_dace.py
│ │ │ │ ├── nussinov_dpnp.py
│ │ │ │ ├── nussinov_numba_dpex_n.py
│ │ │ │ ├── nussinov_numba_n.py
│ │ │ │ ├── nussinov_numba_np.py
│ │ │ │ ├── nussinov_numpy.py
│ │ │ │ └── nussinov_pythran.py
│ │ └── stencils
│ │ │ ├── adi
│ │ │ ├── adi.py
│ │ │ ├── adi_cupy.py
│ │ │ ├── adi_dace.py
│ │ │ ├── adi_dask.py
│ │ │ ├── adi_dpnp.py
│ │ │ ├── adi_legate.py
│ │ │ ├── adi_numba_dpex_n.py
│ │ │ ├── adi_numba_n.py
│ │ │ ├── adi_numba_np.py
│ │ │ ├── adi_numpy.py
│ │ │ └── adi_pythran.py
│ │ │ ├── fdtd_2d
│ │ │ ├── fdtd_2d.py
│ │ │ ├── fdtd_2d_cupy.py
│ │ │ ├── fdtd_2d_dace.py
│ │ │ ├── fdtd_2d_dpnp.py
│ │ │ ├── fdtd_2d_numba_dpex_n.py
│ │ │ ├── fdtd_2d_numba_n.py
│ │ │ ├── fdtd_2d_numba_np.py
│ │ │ ├── fdtd_2d_numpy.py
│ │ │ └── fdtd_2d_pythran.py
│ │ │ ├── heat_3d
│ │ │ ├── heat_3d.py
│ │ │ ├── heat_3d_cupy.py
│ │ │ ├── heat_3d_dace.py
│ │ │ ├── heat_3d_dpnp.py
│ │ │ ├── heat_3d_numba_dpex_n.py
│ │ │ ├── heat_3d_numba_n.py
│ │ │ ├── heat_3d_numba_np.py
│ │ │ ├── heat_3d_numpy.py
│ │ │ └── heat_3d_pythran.py
│ │ │ ├── jacobi_1d
│ │ │ ├── jacobi_1d.py
│ │ │ ├── jacobi_1d_cupy.py
│ │ │ ├── jacobi_1d_dace.py
│ │ │ ├── jacobi_1d_dpnp.py
│ │ │ ├── jacobi_1d_numba_dpex_n.py
│ │ │ ├── jacobi_1d_numba_n.py
│ │ │ ├── jacobi_1d_numba_np.py
│ │ │ ├── jacobi_1d_numpy.py
│ │ │ └── jacobi_1d_pythran.py
│ │ │ ├── jacobi_2d
│ │ │ ├── jacobi_2d.py
│ │ │ ├── jacobi_2d_cupy.py
│ │ │ ├── jacobi_2d_dace.py
│ │ │ ├── jacobi_2d_dpnp.py
│ │ │ ├── jacobi_2d_numba_dpex_n.py
│ │ │ ├── jacobi_2d_numba_n.py
│ │ │ ├── jacobi_2d_numba_np.py
│ │ │ ├── jacobi_2d_numpy.py
│ │ │ └── jacobi_2d_pythran.py
│ │ │ └── seidel_2d
│ │ │ ├── seidel_2d.py
│ │ │ ├── seidel_2d_cupy.py
│ │ │ ├── seidel_2d_dace.py
│ │ │ ├── seidel_2d_dpnp.py
│ │ │ ├── seidel_2d_numba_dpex_n.py
│ │ │ ├── seidel_2d_numba_n.py
│ │ │ ├── seidel_2d_numba_np.py
│ │ │ ├── seidel_2d_numpy.py
│ │ │ └── seidel_2d_pythran.py
│ └── rodinia
│ │ ├── CMakeLists.txt
│ │ └── gaussian
│ │ ├── CMakeLists.txt
│ │ ├── __init__.py
│ │ ├── gaussian_initialize.py
│ │ ├── gaussian_numba_dpex_k.py
│ │ ├── gaussian_python.py
│ │ └── gaussian_sycl_native_ext
│ │ ├── CMakeLists.txt
│ │ ├── __init__.py
│ │ └── gaussian_sycl
│ │ ├── _gaussian_kernel.hpp
│ │ └── _gaussian_sycl.cpp
├── config
│ ├── __init__.py
│ ├── benchmark.py
│ ├── config.py
│ ├── framework.py
│ ├── implementation_postfix.py
│ ├── module.py
│ └── reader.py
├── configs
│ ├── bench_info
│ │ ├── black_scholes.toml
│ │ ├── dbscan.toml
│ │ ├── gpairs.toml
│ │ ├── kmeans.toml
│ │ ├── knn.toml
│ │ ├── l2_norm.toml
│ │ ├── npbench
│ │ │ ├── arc_distance.toml
│ │ │ ├── azimint_hist.toml
│ │ │ ├── azimint_naive.toml
│ │ │ ├── cavity_flow.toml
│ │ │ ├── channel_flow.toml
│ │ │ ├── compute.toml
│ │ │ ├── contour_integral.toml
│ │ │ ├── conv2d_bias.toml
│ │ │ ├── crc16.toml
│ │ │ ├── go_fast.toml
│ │ │ ├── hdiff.toml
│ │ │ ├── lenet.toml
│ │ │ ├── mandelbrot1.toml
│ │ │ ├── mandelbrot2.toml
│ │ │ ├── mlp.toml
│ │ │ ├── nbody.toml
│ │ │ ├── resnet.toml
│ │ │ ├── scattering_self_energies.toml
│ │ │ ├── softmax.toml
│ │ │ ├── spmv.toml
│ │ │ ├── stockham_fft.toml
│ │ │ └── vadv.toml
│ │ ├── pairwise_distance.toml
│ │ ├── pca.toml
│ │ ├── polybench
│ │ │ ├── datamining
│ │ │ │ ├── correlation.toml
│ │ │ │ └── covariance.toml
│ │ │ ├── linear-algebra
│ │ │ │ ├── blas
│ │ │ │ │ ├── gemm.toml
│ │ │ │ │ ├── gemver.toml
│ │ │ │ │ ├── gesummv.toml
│ │ │ │ │ ├── symm.toml
│ │ │ │ │ ├── syr2k.toml
│ │ │ │ │ ├── syrk.toml
│ │ │ │ │ └── trmm.toml
│ │ │ │ ├── kernels
│ │ │ │ │ ├── atax.toml
│ │ │ │ │ ├── bicg.toml
│ │ │ │ │ ├── doitgen.toml
│ │ │ │ │ ├── k2mm.toml
│ │ │ │ │ ├── k3mm.toml
│ │ │ │ │ └── mvt.toml
│ │ │ │ └── solvers
│ │ │ │ │ ├── cholesky.toml
│ │ │ │ │ ├── cholesky2.toml
│ │ │ │ │ ├── durbin.toml
│ │ │ │ │ ├── gramschmidt.toml
│ │ │ │ │ ├── lu.toml
│ │ │ │ │ ├── ludcmp.toml
│ │ │ │ │ └── trisolv.toml
│ │ │ ├── medley
│ │ │ │ ├── deriche.toml
│ │ │ │ ├── floyd_warshall.toml
│ │ │ │ └── nussinov.toml
│ │ │ └── stencils
│ │ │ │ ├── adi.toml
│ │ │ │ ├── fdtd_2d.toml
│ │ │ │ ├── heat_3d.toml
│ │ │ │ ├── jacobi_1d.toml
│ │ │ │ ├── jacobi_2d.toml
│ │ │ │ └── seidel_2d.toml
│ │ ├── rambo.toml
│ │ └── rodinia
│ │ │ └── gaussian.toml
│ ├── framework_info
│ │ ├── cupy.toml
│ │ ├── dpcpp.toml
│ │ ├── dpnp.toml
│ │ ├── numba.toml
│ │ ├── numba_cuda.toml
│ │ ├── numba_dpex.toml
│ │ ├── numba_mlir.toml
│ │ ├── numpy.toml
│ │ └── python.toml
│ └── precision_dtypes.toml
├── console
│ ├── __init__.py
│ ├── _namespace.py
│ ├── config.py
│ ├── entry.py
│ ├── report.py
│ └── run.py
├── infrastructure
│ ├── __init__.py
│ ├── benchmark.py
│ ├── benchmark_results.py
│ ├── benchmark_runner.py
│ ├── benchmark_validation.py
│ ├── datamodel.py
│ ├── enums.py
│ ├── frameworks
│ │ ├── __init__.py
│ │ ├── cupy_framework.py
│ │ ├── dpcpp_framework.py
│ │ ├── dpnp_framework.py
│ │ ├── fabric.py
│ │ ├── framework.py
│ │ ├── numba_cuda_framework.py
│ │ ├── numba_dpex_framework.py
│ │ ├── numba_framework.py
│ │ └── numba_mlir_framework.py
│ ├── reporter.py
│ └── timer.py
└── migrations
│ ├── README
│ ├── __init__.py
│ ├── alembic.ini
│ ├── env.py
│ ├── script.py.mako
│ └── versions
│ ├── 6477ee64f532_init.py
│ ├── __init__.py
│ └── c1afe59771e9_add_postfixes.py
├── environments
├── conda-linux-sycl.yml
├── conda-win-sycl.yml
└── conda.yml
├── pyproject.toml
├── scripts
├── convert_json.py
└── set_expected_failure.py
└── setup.py
/.clang-format:
--------------------------------------------------------------------------------
1 | BasedOnStyle: LLVM
2 | IndentWidth: 4
3 | AccessModifierOffset: -4
4 | AlignEscapedNewlines: Right
5 | AllowAllParametersOfDeclarationOnNextLine: false
6 | BinPackParameters: false
7 | BreakBeforeBraces: Custom
8 | BraceWrapping:
9 | AfterCaseLabel: true
10 | AfterClass: true
11 | AfterControlStatement: MultiLine
12 | AfterEnum: true
13 | AfterFunction: true
14 | AfterNamespace: true
15 | AfterObjCDeclaration: false
16 | AfterStruct: true
17 | AfterUnion: true
18 | AfterExternBlock: true
19 | BeforeCatch: false
20 | BeforeElse: true
21 | IndentBraces: false
22 | SplitEmptyFunction: true
23 | SplitEmptyRecord: true
24 | SplitEmptyNamespace: true
25 |
--------------------------------------------------------------------------------
/.flake8:
--------------------------------------------------------------------------------
1 | [flake8]
2 | max-line-length = 80
3 | # TODO: keep just E203
4 | extend-ignore = E203, E266, F401, E501
5 | # TODO: fix excludes
6 | exclude =
7 | ./.git
8 | __pycache__
9 | ./dist
10 | ./setup.py
11 | ./dpbench/_version.py
12 | max-complexity = 10
13 |
--------------------------------------------------------------------------------
/.git-blame-ignore-revs:
--------------------------------------------------------------------------------
1 | # $ git config blame.ignoreRevsFile .git-blame-ignore-revs
2 |
3 | # Migrate code style to Black
4 | edf70949f6ebe9c79deea1e1fda128bb9a44d61e
5 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | dpbench/_version.py export-subst
6 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 |
6 |
7 | - [ ] Have you provided a meaningful PR description?
8 | - [ ] Have you added a test, reproducer or referred to an issue with a reproducer?
9 | - [ ] Have you tested your changes locally for CPU and GPU devices?
10 | - [ ] Have you made sure that new changes do not introduce compiler warnings?
11 | - [ ] If this PR is a work in progress, are you filing the PR as a draft?
12 |
--------------------------------------------------------------------------------
/.github/workflows/pre-commit.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | name: pre-commit
6 |
7 | # Declare default permissions as read only.
8 | permissions: read-all
9 |
10 | on:
11 | pull_request:
12 |
13 | jobs:
14 | pre-commit:
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: actions/checkout@v3
18 | - uses: actions/setup-python@v4
19 | - uses: pre-commit/action@v3.0.0
20 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 |
6 |
7 | # Security Policy
8 | Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.
9 |
10 | ## Reporting a Vulnerability
11 | Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).
12 |
--------------------------------------------------------------------------------
/dpbench/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(benchmarks)
6 |
--------------------------------------------------------------------------------
/dpbench/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | from . import _version
6 |
7 | __version__ = _version.get_versions()["version"]
8 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(default)
6 | add_subdirectory(rodinia)
7 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/black_scholes/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(black_scholes_sycl_native_ext)
6 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/black_scholes/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """
6 | The Black-Scholes program computes the price of a portfolio of
7 | options using partial differential equations.
8 | The entire computation performed by Black-Scholes is data-parallel
9 | where each option can be priced independent of other options.
10 |
11 | Input
12 | ---------
13 | nopt: int
14 | number of options
15 | price, strike, t: double
16 | vectors representing different components of portfolio
17 | rate, volatility: int
18 | scalars used for price computation
19 |
20 | Output
21 | -------
22 | call, put: double
23 | output vectors
24 | """
25 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/black_scholes/black_scholes_sycl_native_ext/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | set(module_name black_scholes_sycl)
6 | set(py_module_name _${module_name})
7 | python_add_library(${py_module_name} MODULE ${module_name}/${py_module_name}.cpp)
8 | add_sycl_to_target(TARGET ${py_module_name} SOURCES ${module_name}/${py_module_name}.cpp)
9 | target_include_directories(${py_module_name} PRIVATE ${Dpctl_INCLUDE_DIRS})
10 |
11 | file(RELATIVE_PATH py_module_dest ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
12 | install(TARGETS ${py_module_name}
13 | DESTINATION ${py_module_dest}/${module_name}
14 | )
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/black_scholes/black_scholes_sycl_native_ext/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | from .black_scholes_sycl._black_scholes_sycl import (
6 | black_scholes as black_scholes_sycl,
7 | )
8 |
9 | __all__ = ["black_scholes_sycl"]
10 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/dbscan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(dbscan_sycl_native_ext)
6 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/dbscan/dbscan_python.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numpy as np
6 | from sklearn.cluster import DBSCAN
7 |
8 |
9 | def dbscan(n_samples, n_features, data, eps, min_pts):
10 | data = np.reshape(data, (n_samples, n_features))
11 | labels = DBSCAN(eps=eps, min_samples=min_pts).fit_predict(data)
12 | return len(set(labels)) - (1 if -1 in labels else 0)
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/dbscan/dbscan_sycl_native_ext/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | set(module_name dbscan_sycl)
6 | set(py_module_name _${module_name})
7 | python_add_library(${py_module_name} MODULE ${module_name}/${py_module_name}.cpp)
8 | add_sycl_to_target(TARGET ${py_module_name} SOURCES ${module_name}/${py_module_name}.cpp)
9 | target_include_directories(${py_module_name} PRIVATE ${Dpctl_INCLUDE_DIRS})
10 |
11 | file(RELATIVE_PATH py_module_dest ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
12 | install(TARGETS ${py_module_name}
13 | DESTINATION ${py_module_dest}/${module_name}
14 | )
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/dbscan/dbscan_sycl_native_ext/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | from .dbscan_sycl._dbscan_sycl import dbscan as dbscan_sycl
6 |
7 | __all__ = ["dbscan_sycl"]
8 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/gpairs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(gpairs_sycl_native_ext)
6 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/gpairs/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """
6 | The gpairs benchmark calculates a weighted histogram of the distances between
7 | points in a 3D vector space.
8 |
9 | Input
10 | -----
11 | nopt: int
12 | number of points
13 | nbins: int
14 | number of bins used for histogram computation
15 | x1, x2, y1, y2, z1, z2: double
16 | vectors representing 2 sets of 3-dim points (x1, y1, z1), (x2, y2, z2)
17 | w1, w2: double
18 | vectors representing weights
19 | rbins: double
20 | threshold value for each bin
21 |
22 | Output
23 | -------
24 | result: double
25 | vector representing histogram of pair counts
26 | """
27 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/gpairs/gpairs_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import cupy as cp
6 |
7 |
8 | def _gpairs_impl(x1, y1, z1, w1, x2, y2, z2, w2, rbins):
9 | dm = (
10 | cp.square(x2 - x1[:, None])
11 | + cp.square(y2 - y1[:, None])
12 | + cp.square(z2 - z1[:, None])
13 | )
14 | ret_arr = cp.array(
15 | [cp.outer(w1, w2)[dm <= rbins[k]].sum() for k in range(len(rbins))]
16 | )
17 |
18 | cp.cuda.stream.get_current_stream().synchronize()
19 |
20 | return ret_arr
21 |
22 |
23 | def gpairs(nopt, nbins, x1, y1, z1, w1, x2, y2, z2, w2, rbins, results):
24 | results[:] = _gpairs_impl(x1, y1, z1, w1, x2, y2, z2, w2, rbins)
25 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/gpairs/gpairs_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numpy as np
6 |
7 |
8 | def _gpairs_impl(x1, y1, z1, w1, x2, y2, z2, w2, rbins):
9 | dm = (
10 | np.square(x2 - x1[:, None])
11 | + np.square(y2 - y1[:, None])
12 | + np.square(z2 - z1[:, None])
13 | )
14 | return np.array(
15 | [np.outer(w1, w2)[dm <= rbins[k]].sum() for k in range(len(rbins))]
16 | )
17 |
18 |
19 | def gpairs(nopt, nbins, x1, y1, z1, w1, x2, y2, z2, w2, rbins, results):
20 | results[:] = _gpairs_impl(x1, y1, z1, w1, x2, y2, z2, w2, rbins)
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/gpairs/gpairs_sycl_native_ext/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | set(module_name gpairs_sycl)
6 | set(py_module_name _${module_name})
7 | python_add_library(${py_module_name} MODULE ${module_name}/${py_module_name}.cpp)
8 | add_sycl_to_target(TARGET ${py_module_name} SOURCES ${module_name}/${py_module_name}.cpp)
9 | target_include_directories(${py_module_name} PRIVATE ${Dpctl_INCLUDE_DIRS})
10 |
11 | file(RELATIVE_PATH py_module_dest ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
12 | install(TARGETS ${py_module_name}
13 | DESTINATION ${py_module_dest}/${module_name}
14 | )
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/gpairs/gpairs_sycl_native_ext/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | from .gpairs_sycl._gpairs_sycl import gpairs as gpairs_sycl
6 |
7 | __all__ = ["gpairs_sycl"]
8 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/kmeans/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(kmeans_sycl_native_ext)
6 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/kmeans/kmeans_sycl_native_ext/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | set(module_name kmeans_sycl)
6 | set(py_module_name _${module_name})
7 | python_add_library(${py_module_name} MODULE ${module_name}/${py_module_name}.cpp)
8 | add_sycl_to_target(TARGET ${py_module_name} SOURCES ${module_name}/${py_module_name}.cpp)
9 | target_include_directories(${py_module_name} PRIVATE ${Dpctl_INCLUDE_DIRS})
10 |
11 | file(RELATIVE_PATH py_module_dest ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
12 | install(TARGETS ${py_module_name}
13 | DESTINATION ${py_module_dest}/${module_name}
14 | )
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/kmeans/kmeans_sycl_native_ext/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | from .kmeans_sycl._kmeans_sycl import kmeans as kmeans_sycl
6 |
7 | __all__ = ["kmeans_sycl"]
8 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/knn/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(knn_sycl_native_ext)
6 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/knn/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """
6 | Documentation for knn function
7 |
8 | The knn program calculates the k nearest neighbors of a training set.
9 |
10 | Input
11 | -----
12 | train: double
13 | training set data
14 | train_lables: double
15 | training set results as labels
16 | test: double
17 | test set
18 | train_nrows, test_size: int
19 | training and test set sizes
20 | votes_to_classes: double
21 | vector representing vote labels
22 |
23 | Output
24 | -------
25 | predictions: double
26 | vectors representing output predictions from test set
27 | """
28 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/knn/knn_sycl_native_ext/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | set(module_name knn_sycl)
6 | set(py_module_name _${module_name})
7 | python_add_library(${py_module_name} MODULE ${module_name}/${py_module_name}.cpp)
8 | add_sycl_to_target(TARGET ${py_module_name} SOURCES ${module_name}/${py_module_name}.cpp)
9 | target_include_directories(${py_module_name} PRIVATE ${Dpctl_INCLUDE_DIRS})
10 |
11 | file(RELATIVE_PATH py_module_dest ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
12 | install(TARGETS ${py_module_name}
13 | DESTINATION ${py_module_dest}/${module_name}
14 | )
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/knn/knn_sycl_native_ext/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | from .knn_sycl._knn_sycl import knn as knn_sycl
6 |
7 | __all__ = ["knn_sycl"]
8 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(l2_norm_sycl_native_ext)
6 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """
6 | l2-norm calculation of n vectors
7 |
8 | Input
9 | ---------
10 | npoints: int
11 | number of vectors
12 | dims: int
13 | dimension of single vector
14 | seed: int
15 | random seed to generate random number
16 |
17 | Output
18 | -------
19 | d: array
20 | l2 norm of each vector
21 |
22 | Method
23 | ------
24 | ||Vj||2=sqrt(sum(Xj[i]*Xj[i]))
25 | here i is 0->dims, j is 0->npoints
26 | """
27 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import cupy as cp
6 |
7 |
8 | def l2_norm(a, d):
9 | sq = cp.square(a)
10 | sum = sq.sum(axis=1)
11 | d[:] = cp.sqrt(sum)
12 |
13 | cp.cuda.stream.get_current_stream().synchronize()
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import dpnp as np
6 |
7 |
8 | def l2_norm(a, d):
9 | sq = np.square(a)
10 | sum = sq.sum(axis=1, dtype=sq.dtype)
11 | d[:] = np.sqrt(sum)
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_initialize.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 |
6 | def initialize(npoints, dims, seed, types_dict):
7 | import numpy as np
8 | import numpy.random as default_rng
9 |
10 | dtype = types_dict["float"]
11 |
12 | default_rng.seed(seed)
13 |
14 | return (
15 | default_rng.random((npoints, dims)).astype(dtype),
16 | np.zeros(npoints).astype(dtype),
17 | )
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numba_cuda.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | from math import ceil, sqrt
6 |
7 | from numba import cuda
8 |
9 |
10 | @cuda.jit
11 | def l2_norm_kernel(a, d):
12 | i = cuda.grid(1)
13 |
14 | a_rows = a.shape[1]
15 | d[i] = 0.0
16 | for k in range(a_rows):
17 | d[i] += a[i, k] * a[i, k]
18 | d[i] = sqrt(d[i])
19 |
20 |
21 | def l2_norm(a, d):
22 | nthreads = 256
23 | nblocks = ceil(a.shape[0] // nthreads)
24 |
25 | l2_norm_kernel[nblocks, nthreads](a, d)
26 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numba_dpex_k.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import math
6 |
7 | import numba_dpex as dpex
8 | from numba_dpex import kernel_api as kapi
9 |
10 |
11 | @dpex.kernel
12 | def l2_norm_kernel(item: kapi.Item, a, d):
13 | i = item.get_id(0)
14 | a_rows = a.shape[1]
15 | d[i] = 0.0
16 | for k in range(a_rows):
17 | d[i] += a[i, k] * a[i, k]
18 | d[i] = math.sqrt(d[i])
19 |
20 |
21 | def l2_norm(a, d):
22 | dpex.call_kernel(l2_norm_kernel, kapi.Range(a.shape[0]), a, d)
23 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import dpnp as np
6 | from numba_dpex import dpjit
7 |
8 |
9 | @dpjit
10 | def l2_norm(a, d):
11 | sq = np.square(a)
12 | sum = sq.sum(axis=1)
13 | d[:] = np.sqrt(sum)
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numba_dpex_p.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import dpnp as np
6 | import numba as nb
7 | from numba_dpex import dpjit
8 |
9 |
10 | @dpjit
11 | def l2_norm(a, d):
12 | for i in nb.prange(a.shape[0]):
13 | d[i] = 0.0
14 | for k in range(a.shape[1]):
15 | d[i] += np.square(a[i, k])
16 | d[i] = np.sqrt(d[i])
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numba_mlir_k.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba_mlir.kernel as nb
6 | import numpy as np
7 |
8 |
9 | @nb.kernel
10 | def l2_norm_kernel(a, d):
11 | i = nb.get_global_id(0)
12 | a_rows = a.shape[1]
13 | d[i] = 0.0
14 | for k in range(a_rows):
15 | d[i] += a[i, k] * a[i, k]
16 | d[i] = np.sqrt(d[i])
17 |
18 |
19 | def l2_norm(a, d):
20 | l2_norm_kernel[a.shape[0], nb.DEFAULT_LOCAL_SIZE](a, d)
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numba_mlir_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba_mlir as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=True, fastmath=True)
10 | def _l2_norm(a, d):
11 | sq = np.square(a)
12 | sum = sq.sum(axis=1)
13 | d[:] = np.sqrt(sum)
14 |
15 |
16 | def l2_norm(a, d):
17 | _l2_norm(a, d)
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numba_mlir_p.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba
6 | import numba_mlir as nb
7 | import numpy as np
8 |
9 |
10 | @nb.njit(parallel=True, fastmath=True)
11 | def _l2_norm(a, d):
12 | for i in numba.prange(a.shape[0]):
13 | d[i] = 0.0
14 | for k in range(a.shape[1]):
15 | d[i] += np.square(a[i, k])
16 | d[i] = np.sqrt(d[i])
17 |
18 |
19 | def l2_norm(a, d):
20 | _l2_norm(a, d)
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=False, fastmath=True)
10 | def l2_norm(a, d):
11 | sq = np.square(a)
12 | sum = sq.sum(axis=1)
13 | d[:] = np.sqrt(sum)
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=True, fastmath=True)
10 | def l2_norm(a, d):
11 | sq = np.square(a)
12 | sum = sq.sum(axis=1)
13 | d[:] = np.sqrt(sum)
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numba_npr.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=True, fastmath=True)
10 | def l2_norm(a, d):
11 | for i in nb.prange(a.shape[0]):
12 | d[i] = 0.0
13 | for k in range(a.shape[1]):
14 | d[i] += np.square(a[i, k])
15 | d[i] = np.sqrt(d[i])
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numpy as np
6 |
7 |
8 | def l2_norm(a, d):
9 | sq = np.square(a)
10 | sum = sq.sum(axis=1)
11 | d[:] = np.sqrt(sum)
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_sycl_native_ext/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | set(module_name l2_norm_sycl)
6 | set(py_module_name _${module_name})
7 | python_add_library(${py_module_name} MODULE ${module_name}/${py_module_name}.cpp)
8 | add_sycl_to_target(TARGET ${py_module_name} SOURCES ${module_name}/${py_module_name}.cpp)
9 | target_include_directories(${py_module_name} PRIVATE ${Dpctl_INCLUDE_DIRS})
10 |
11 | file(RELATIVE_PATH py_module_dest ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
12 | install(TARGETS ${py_module_name}
13 | DESTINATION ${py_module_dest}/${module_name}
14 | )
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/l2_norm/l2_norm_sycl_native_ext/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | from .l2_norm_sycl._l2_norm_sycl import l2_norm as l2_norm_sycl
6 |
7 | __all__ = ["l2_norm_sycl"]
8 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(pairwise_distance_sycl_native_ext)
6 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """
6 | Pairwise distance computation of 2 n-dim arrays
7 |
8 | Input
9 | ---------
10 | X1: double
11 | first n-dim array
12 | X2: double
13 | second n-dim array
14 | D : double
15 | distance matrix
16 |
17 | Output
18 | -------
19 | d: array
20 | pairwise distance
21 |
22 | Method
23 | ------
24 | D[i,j]+=sqrt((X1[i, k] - X2[j, k])^2)
25 | here i,j are 0->number of points, k is 0->dims
26 | """
27 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/pairwise_distance_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import cupy as cp
6 |
7 |
8 | def pairwise_distance(X1, X2, D):
9 | x1 = cp.sum(cp.square(X1), axis=1)
10 | x2 = cp.sum(cp.square(X2), axis=1)
11 | cp.dot(X1, X2.T, D)
12 | D *= -2
13 | x3 = x1.reshape(x1.size, 1)
14 | cp.add(D, x3, D)
15 | cp.add(D, x2, D)
16 | cp.sqrt(D, D)
17 |
18 | cp.cuda.stream.get_current_stream().synchronize()
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/pairwise_distance_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import dpnp as np
6 |
7 |
8 | def pairwise_distance(X1, X2, D):
9 | x1 = np.sum(np.square(X1), axis=1, dtype=X1.dtype)
10 | x2 = np.sum(np.square(X2), axis=1, dtype=X2.dtype)
11 | np.dot(X1, X2.T, D)
12 | D *= -2
13 | x3 = x1.reshape(x1.size, 1)
14 | np.add(D, x3, D)
15 | np.add(D, x2, D)
16 | np.sqrt(D, D)
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/pairwise_distance_initialize.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 |
6 | def initialize(npoints, dims, seed, types_dict):
7 | import numpy as np
8 | import numpy.random as default_rng
9 |
10 | dtype = types_dict["float"]
11 |
12 | default_rng.seed(seed)
13 |
14 | return (
15 | default_rng.random((npoints, dims)).astype(dtype),
16 | default_rng.random((npoints, dims)).astype(dtype),
17 | np.empty((npoints, npoints), dtype),
18 | )
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/pairwise_distance_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import dpnp as np
6 | from numba_dpex import dpjit
7 |
8 |
9 | @dpjit
10 | def pairwise_distance(X1, X2, D):
11 | x1 = np.sum(np.square(X1), axis=1)
12 | x2 = np.sum(np.square(X2), axis=1)
13 | np.dot(X1, X2.T, D)
14 | D *= -2
15 | x3 = x1.reshape(x1.size, 1)
16 | np.add(D, x3, D)
17 | np.add(D, x2, D)
18 | np.sqrt(D, D)
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/pairwise_distance_numba_mlir_k.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba_mlir.kernel as nb
6 | import numpy as np
7 |
8 |
9 | @nb.kernel(gpu_fp64_truncate="auto")
10 | def _pairwise_distance_kernel(X1, X2, D):
11 | i = nb.get_global_id(1)
12 | j = nb.get_global_id(0)
13 |
14 | X1_cols = X1.shape[1]
15 |
16 | d = 0.0
17 | for k in range(X1_cols):
18 | tmp = X1[i, k] - X2[j, k]
19 | d += tmp * tmp
20 | D[i, j] = np.sqrt(d)
21 |
22 |
23 | def pairwise_distance(X1, X2, D):
24 | _pairwise_distance_kernel[
25 | (X2.shape[0], X1.shape[0]), nb.DEFAULT_LOCAL_SIZE
26 | ](X1, X2, D)
27 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/pairwise_distance_numba_mlir_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba_mlir as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=True, fastmath=True, gpu_fp64_truncate="auto")
10 | def _pairwise_distance(X1, X2, D):
11 | x1 = np.sum(np.square(X1), axis=1)
12 | x2 = np.sum(np.square(X2), axis=1)
13 | np.dot(X1, X2.T, D)
14 | D *= -2
15 | x3 = x1.reshape(x1.size, 1)
16 | np.add(D, x3, D)
17 | np.add(D, x2, D)
18 | np.sqrt(D, D)
19 |
20 |
21 | def pairwise_distance(X1, X2, D):
22 | _pairwise_distance(X1, X2, D)
23 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/pairwise_distance_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=True, fastmath=True)
10 | def pairwise_distance(X1, X2, D):
11 | x1 = np.sum(np.square(X1), axis=1)
12 | x2 = np.sum(np.square(X2), axis=1)
13 | np.dot(X1, X2.T, D)
14 | D *= -2
15 | x3 = x1.reshape(x1.size, 1)
16 | np.add(D, x3, D)
17 | np.add(D, x2, D)
18 | np.sqrt(D, D)
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/pairwise_distance_numba_npr.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=True, fastmath=True)
10 | def pairwise_distance(X1, X2, D):
11 | X1_rows = X1.shape[0]
12 | X2_rows = X2.shape[0]
13 | X1_cols = X1.shape[1]
14 | for i in nb.prange(X1_rows):
15 | for j in range(X2_rows):
16 | d = 0.0
17 | for k in range(X1_cols):
18 | tmp = X1[i, k] - X2[j, k]
19 | d += tmp * tmp
20 | D[i, j] = np.sqrt(d)
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/pairwise_distance_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numpy as np
6 |
7 |
8 | def pairwise_distance(X1, X2, D):
9 | x1 = np.sum(np.square(X1), axis=1)
10 | x2 = np.sum(np.square(X2), axis=1)
11 | np.dot(X1, X2.T, D)
12 | D *= -2
13 | x3 = x1.reshape(x1.size, 1)
14 | np.add(D, x3, D)
15 | np.add(D, x2, D)
16 | np.sqrt(D, D)
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pairwise_distance/pairwise_distance_sycl_native_ext/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | from .pairwise_distance_sycl._pairwise_distance_sycl import (
6 | pairwise_distance as pairwise_distance_sycl,
7 | )
8 |
9 | __all__ = ["pairwise_distance_sycl"]
10 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pca/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """
6 | Principle Component Analysis
7 |
8 | Input
9 | ---------
10 | data : array
11 | random regression problem
12 |
13 | Output
14 | -------
15 | data: array
16 | transformation on the data using eigenvectors
17 |
18 | evalues: array
19 | Eigen values
20 |
21 | evectors: array
22 | Eigen vectors
23 |
24 | Method
25 | ------
26 | PCA implementation using covariance approach.
27 | Step 1) Calculate covariance matrix
28 | Step 2) Compute eigen values and eigen vectors from the covariance matrix
29 | """
30 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pca/pca_initialize.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 |
6 | def initialize(npoints, dims):
7 | from sklearn.datasets import make_regression
8 |
9 | return make_regression(n_samples=npoints, n_features=dims, random_state=0)
10 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/pca/pca_validate.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 | from dpbench.infrastructure.benchmark_validation import (
5 | validate as default_validate,
6 | )
7 |
8 |
9 | def validate(expected: dict[str, any], actual: dict[str, any], rel_error=1e-05):
10 | # TODO implement actual validation suitable for pca workload
11 | return default_validate(expected, actual, rel_error)
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(rambo_sycl_native_ext)
6 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """
6 | The Rambo algorithm is a high energy physics application
7 | that performs phase integration to produce a flat
8 | phase-space with constant volume for massless particles.
9 |
10 | Input
11 | ---------
12 | nevts: int
13 | number of events
14 | nout: int
15 | number of out particles
16 | C1, F1, Q1: float
17 | input vectors
18 | output: float
19 | output of particles
20 |
21 | Output
22 | -------
23 | output: float
24 | output vector
25 | """
26 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import cupy as cp
6 |
7 |
8 | def rambo(nevts, nout, C1, F1, Q1, output):
9 | C = 2.0 * C1 - 1.0
10 | S = cp.sqrt(1 - cp.square(C))
11 | F = 2.0 * cp.pi * F1
12 | Q = -cp.log(Q1)
13 |
14 | output[:, :, 0] = Q
15 | output[:, :, 1] = Q * S * cp.sin(F)
16 | output[:, :, 2] = Q * S * cp.cos(F)
17 | output[:, :, 3] = Q * C
18 |
19 | cp.cuda.stream.get_current_stream().synchronize()
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import dpnp as np
6 |
7 |
8 | def rambo(nevts, nout, C1, F1, Q1, output):
9 | C = 2.0 * C1 - 1.0
10 | S = np.sqrt(1 - np.square(C))
11 | F = 2.0 * np.pi * F1
12 | Q = -np.log(Q1)
13 |
14 | output[:, :, 0] = Q
15 | output[:, :, 1] = Q * S * np.sin(F)
16 | output[:, :, 2] = Q * S * np.cos(F)
17 | output[:, :, 3] = Q * C
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_initialize.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 |
6 | def initialize(nevts, nout, types_dict):
7 | import numpy as np
8 |
9 | dtype = types_dict["float"]
10 |
11 | C1 = np.empty((nevts, nout), dtype=dtype)
12 | F1 = np.empty((nevts, nout), dtype=dtype)
13 | Q1 = np.empty((nevts, nout), dtype=dtype)
14 |
15 | np.random.seed(777)
16 | for i in range(nevts):
17 | for j in range(nout):
18 | C1[i, j] = np.random.rand()
19 | F1[i, j] = np.random.rand()
20 | Q1[i, j] = np.random.rand() * np.random.rand()
21 |
22 | return (C1, F1, Q1, np.empty((nevts, nout, 4), dtype))
23 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import dpnp as np
6 | from numba_dpex import dpjit
7 |
8 |
9 | @dpjit
10 | def rambo(nevts, nout, C1, F1, Q1, output):
11 | C = 2.0 * C1 - 1.0
12 | S = np.sqrt(1 - np.square(C))
13 | F = 2.0 * np.pi * F1
14 | Q = -np.log(Q1)
15 |
16 | output[:, :, 0] = Q
17 | output[:, :, 1] = Q * S * np.sin(F)
18 | output[:, :, 2] = Q * S * np.cos(F)
19 | output[:, :, 3] = Q * C
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_numba_mlir_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba_mlir as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=True, fastmath=True, gpu_fp64_truncate="auto")
10 | def rambo(nevts, nout, C1, F1, Q1, output):
11 | C = 2.0 * C1 - 1.0
12 | S = np.sqrt(1 - np.square(C))
13 | F = 2.0 * np.pi * F1
14 | Q = -np.log(Q1)
15 |
16 | output[:, :, 0] = Q
17 | output[:, :, 1] = Q * S * np.sin(F)
18 | output[:, :, 2] = Q * S * np.cos(F)
19 | output[:, :, 3] = Q * C
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=False, fastmath=True)
10 | def rambo(nevts, nout, C1, F1, Q1, output):
11 | for i in range(nevts):
12 | for j in range(nout):
13 | C = 2.0 * C1[i, j] - 1.0
14 | S = np.sqrt(1 - np.square(C))
15 | F = 2.0 * np.pi * F1[i, j]
16 | Q = -np.log(Q1[i, j])
17 |
18 | output[i, j, 0] = Q
19 | output[i, j, 1] = Q * S * np.sin(F)
20 | output[i, j, 2] = Q * S * np.cos(F)
21 | output[i, j, 3] = Q * C
22 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=True, fastmath=True)
10 | def rambo(nevts, nout, C1, F1, Q1, output):
11 | C = 2.0 * C1 - 1.0
12 | S = np.sqrt(1 - np.square(C))
13 | F = 2.0 * np.pi * F1
14 | Q = -np.log(Q1)
15 |
16 | output[:, :, 0] = Q
17 | output[:, :, 1] = Q * S * np.sin(F)
18 | output[:, :, 2] = Q * S * np.cos(F)
19 | output[:, :, 3] = Q * C
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_numba_npr.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numba as nb
6 | import numpy as np
7 |
8 |
9 | @nb.njit(parallel=True, fastmath=True)
10 | def rambo(nevts, nout, C1, F1, Q1, output):
11 | for i in nb.prange(nevts):
12 | for j in range(nout):
13 | C = 2.0 * C1[i, j] - 1.0
14 | S = np.sqrt(1 - np.square(C))
15 | F = 2.0 * np.pi * F1[i, j]
16 | Q = -np.log(Q1[i, j])
17 |
18 | output[i, j, 0] = Q
19 | output[i, j, 1] = Q * S * np.sin(F)
20 | output[i, j, 2] = Q * S * np.cos(F)
21 | output[i, j, 3] = Q * C
22 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numpy as np
6 |
7 |
8 | def rambo(nevts, nout, C1, F1, Q1, output):
9 | C = 2.0 * C1 - 1.0
10 | S = np.sqrt(1 - np.square(C))
11 | F = 2.0 * np.pi * F1
12 | Q = -np.log(Q1)
13 |
14 | output[:, :, 0] = Q
15 | output[:, :, 1] = Q * S * np.sin(F)
16 | output[:, :, 2] = Q * S * np.cos(F)
17 | output[:, :, 3] = Q * C
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_python.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | import numpy as np
6 |
7 |
8 | def rambo(nevts, nout, C1, F1, Q1, output):
9 | for i in range(nevts):
10 | for j in range(nout):
11 | C = 2.0 * C1[i, j] - 1.0
12 | S = np.sqrt(1 - np.square(C))
13 | F = 2.0 * np.pi * F1[i, j]
14 | Q = -np.log(Q1[i, j])
15 |
16 | output[i, j, 0] = Q
17 | output[i, j, 1] = Q * S * np.sin(F)
18 | output[i, j, 2] = Q * S * np.cos(F)
19 | output[i, j, 3] = Q * C
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_sycl_native_ext/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | set(module_name rambo_sycl)
6 | set(py_module_name _${module_name})
7 | python_add_library(${py_module_name} MODULE ${module_name}/${py_module_name}.cpp)
8 | add_sycl_to_target(TARGET ${py_module_name} SOURCES ${module_name}/${py_module_name}.cpp)
9 | target_include_directories(${py_module_name} PRIVATE ${Dpctl_INCLUDE_DIRS})
10 |
11 | file(RELATIVE_PATH py_module_dest ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
12 | install(TARGETS ${py_module_name}
13 | DESTINATION ${py_module_dest}/${module_name}
14 | )
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/default/rambo/rambo_sycl_native_ext/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | from .rambo_sycl._rambo_sycl import rambo as rambo_sycl
6 |
7 | __all__ = ["rambo_sycl"]
8 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/azimint_hist/azimint_hist.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2014 Jérôme Kieffer et al.
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 |
8 | def initialize(N):
9 | from numpy.random import default_rng
10 |
11 | rng = default_rng(42)
12 | data, radius = rng.random((N,)), rng.random((N,))
13 | return data, radius
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/azimint_hist/azimint_hist_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2014 Jérôme Kieffer et al.
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 |
8 | """
9 | Jérôme Kieffer and Giannis Ashiotis. Pyfai: a python library for
10 | high performance azimuthal integration on gpu, 2014. In Proceedings of the
11 | 7th European Conference on Python in Science (EuroSciPy 2014).
12 | """
13 |
14 | import cupy as np
15 |
16 |
17 | def azimint_hist(data, radius, npt):
18 | histu = np.histogram(radius, npt)[0]
19 | histw = np.histogram(radius, npt, weights=data)[0]
20 | return histw / histu
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/azimint_hist/azimint_hist_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2014 Jérôme Kieffer et al.
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | """
8 | Jérôme Kieffer and Giannis Ashiotis. Pyfai: a python library for
9 | high performance azimuthal integration on gpu, 2014. In Proceedings of the
10 | 7th European Conference on Python in Science (EuroSciPy 2014).
11 | """
12 |
13 | import dpnp as np
14 |
15 |
16 | def azimint_hist(data, radius, npt):
17 | histu = np.histogram(radius, npt)[0]
18 | histw = np.histogram(radius, npt, weights=data)[0]
19 | return histw / histu
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/azimint_hist/azimint_hist_legate.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2014 Jérôme Kieffer et al.
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | """
8 | Jérôme Kieffer and Giannis Ashiotis. Pyfai: a python library for
9 | high performance azimuthal integration on gpu, 2014. In Proceedings of the
10 | 7th European Conference on Python in Science (EuroSciPy 2014).
11 | """
12 |
13 | import legate.numpy as np
14 |
15 |
16 | def azimint_hist(data, radius, npt):
17 | histu = np.histogram(radius, npt)[0]
18 | histw = np.histogram(radius, npt, weights=data)[0]
19 | return histw / histu
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/azimint_hist/azimint_hist_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2014 Jérôme Kieffer et al.
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | """
8 | Jérôme Kieffer and Giannis Ashiotis. Pyfai: a python library for
9 | high performance azimuthal integration on gpu, 2014. In Proceedings of the
10 | 7th European Conference on Python in Science (EuroSciPy 2014).
11 | """
12 |
13 | import numpy as np
14 |
15 |
16 | def azimint_hist(data, radius, npt):
17 | histu = np.histogram(radius, npt)[0]
18 | histw = np.histogram(radius, npt, weights=data)[0]
19 | return histw / histu
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/azimint_naive/azimint_naive.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2014 Jérôme Kieffer et al.
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 |
8 | def initialize(N):
9 | from numpy.random import default_rng
10 |
11 | rng = default_rng(42)
12 | data, radius = rng.random((N,)), rng.random((N,))
13 | return data, radius
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/cavity_flow/cavity_flow.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2017 Lorena A. Barba, Gilbert F. Forsyth.
2 | # SPDX-FileCopyrightText: 2018 Barba, Lorena A., and Forsyth, Gilbert F.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | import numpy as np
9 |
10 |
11 | def initialize(ny, nx):
12 | u = np.zeros((ny, nx), dtype=np.float64)
13 | v = np.zeros((ny, nx), dtype=np.float64)
14 | p = np.zeros((ny, nx), dtype=np.float64)
15 | dx = 2 / (nx - 1)
16 | dy = 2 / (ny - 1)
17 | dt = 0.1 / ((nx - 1) * (ny - 1))
18 | return u, v, p, dx, dy, dt
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/channel_flow/channel_flow.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2017 Lorena A. Barba, Gilbert F. Forsyth.
2 | # SPDX-FileCopyrightText: 2018 Barba, Lorena A., and Forsyth, Gilbert F.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | import numpy as np
9 |
10 |
11 | def initialize(ny, nx):
12 | u = np.zeros((ny, nx), dtype=np.float64)
13 | v = np.zeros((ny, nx), dtype=np.float64)
14 | p = np.ones((ny, nx), dtype=np.float64)
15 | dx = 2 / (nx - 1)
16 | dy = 2 / (ny - 1)
17 | dt = 0.1 / ((nx - 1) * (ny - 1))
18 | return u, v, p, dx, dy, dt
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | import numpy as np
9 |
10 |
11 | def initialize(M, N):
12 | from numpy.random import default_rng
13 |
14 | rng = default_rng(42)
15 | array_1 = rng.uniform(0, 1000, size=(M, N)).astype(np.int64)
16 | array_2 = rng.uniform(0, 1000, size=(M, N)).astype(np.int64)
17 | a = np.int64(4)
18 | b = np.int64(3)
19 | c = np.int64(9)
20 | return array_1, array_2, a, b, c
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | # https://cython.readthedocs.io/en/latest/src/userguide/numpy_tutorial.html
9 |
10 | import cupy as np
11 |
12 |
13 | def compute(array_1, array_2, a, b, c):
14 | return np.clip(array_1, 2, 10) * a + array_2 * b + c
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | # https://cython.readthedocs.io/en/latest/src/userguide/numpy_tutorial.html
9 |
10 | import dpnp as np
11 |
12 |
13 | def compute(array_1, array_2, a, b, c):
14 | return np.clip(array_1, 2, 10) * a + array_2 * b + c
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute_legate.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | # https://cython.readthedocs.io/en/latest/src/userguide/numpy_tutorial.html
9 |
10 | import legate.numpy as np
11 |
12 |
13 | def compute(array_1, array_2, a, b, c):
14 | return np.clip(array_1, 2, 10) * a + array_2 * b + c
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | # https://cython.readthedocs.io/en/latest/src/userguide/numpy_tutorial.html
9 |
10 | import dpnp as np
11 | from numba_dpex import dpjit
12 |
13 |
14 | @dpjit
15 | def compute(array_1, array_2, a, b, c):
16 | # return np.clip(array_1, 2, 10) * a + array_2 * b + c
17 | return np.minimum(np.maximum(array_1, 2), 10) * a + array_2 * b + c
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | # https://cython.readthedocs.io/en/latest/src/userguide/numpy_tutorial.html
9 |
10 | import numba as nb
11 | import numpy as np
12 |
13 |
14 | @nb.jit(nopython=True, parallel=False, fastmath=True)
15 | def compute(array_1, array_2, a, b, c):
16 | # return np.clip(array_1, 2, 10) * a + array_2 * b + c
17 | return np.minimum(np.maximum(array_1, 2), 10) * a + array_2 * b + c
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | # https://cython.readthedocs.io/en/latest/src/userguide/numpy_tutorial.html
9 |
10 | import numba as nb
11 | import numpy as np
12 |
13 |
14 | @nb.jit(nopython=True, parallel=True, fastmath=True)
15 | def compute(array_1, array_2, a, b, c):
16 | # return np.clip(array_1, 2, 10) * a + array_2 * b + c
17 | return np.minimum(np.maximum(array_1, 2), 10) * a + array_2 * b + c
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute_numba_o.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | # https://cython.readthedocs.io/en/latest/src/userguide/numpy_tutorial.html
9 |
10 | import numba as nb
11 | import numpy as np
12 |
13 |
14 | @nb.jit(nopython=False, forceobj=True, parallel=False, fastmath=True)
15 | def compute(array_1, array_2, a, b, c):
16 | return np.clip(array_1, 2, 10) * a + array_2 * b + c
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute_numba_op.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | # https://cython.readthedocs.io/en/latest/src/userguide/numpy_tutorial.html
9 |
10 | import numba as nb
11 | import numpy as np
12 |
13 |
14 | @nb.jit(nopython=False, forceobj=True, parallel=True, fastmath=True)
15 | def compute(array_1, array_2, a, b, c):
16 | return np.clip(array_1, 2, 10) * a + array_2 * b + c
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | # https://cython.readthedocs.io/en/latest/src/userguide/numpy_tutorial.html
9 |
10 | import numpy as np
11 |
12 |
13 | def compute(array_1, array_2, a, b, c):
14 | return np.clip(array_1, 2, 10) * a + array_2 * b + c
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/compute/compute_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Stefan Behnel, Robert Bradshaw,
2 | # Dag Sverre Seljebotn, Greg Ewing, William Stein, Gabriel Gellner, et al.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: BSD-3-Clause
7 |
8 | # https://cython.readthedocs.io/en/latest/src/userguide/numpy_tutorial.html
9 |
10 | import numpy as np
11 |
12 |
13 | # pythran export compute(int64[:,:], int64[:,:], int64, int64, int64)
14 | def compute(array_1, array_2, a, b, c):
15 | return np.clip(array_1, 2, 10) * a + array_2 * b + c
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/contour_integral/contour_integral.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def rng_complex(shape, rng):
10 | return rng.random(shape) + rng.random(shape) * 1j
11 |
12 |
13 | def initialize(NR, NM, slab_per_bc, num_int_pts):
14 | from numpy.random import default_rng
15 |
16 | rng = default_rng(42)
17 | Ham = rng_complex((slab_per_bc + 1, NR, NR), rng)
18 | int_pts = rng_complex((num_int_pts,), rng)
19 | Y = rng_complex((NR, NM), rng)
20 | return Ham, int_pts, Y
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/crc16/crc16.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N):
10 | from numpy.random import default_rng
11 |
12 | rng = default_rng(42)
13 | data = rng.integers(0, 256, size=(N,), dtype=np.uint8)
14 | return data
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/crc16/crc16_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2018 Øystein Sture
2 | #
3 | # SPDX-License-Identifier: BSD-3-Clause
4 |
5 | import dpnp as np
6 |
7 |
8 | # Adapted from https://gist.github.com/oysstu/68072c44c02879a2abf94ef350d1c7c6
9 | def crc16(data, poly=0x8408):
10 | """
11 | CRC-16-CCITT Algorithm
12 | """
13 | crc = 0xFFFF
14 | for b in data:
15 | cur_byte = 0xFF & b
16 | for _ in range(0, 8):
17 | if (crc & 0x0001) ^ (cur_byte & 0x0001):
18 | crc = (crc >> 1) ^ poly
19 | else:
20 | crc >>= 1
21 | cur_byte >>= 1
22 | crc = ~crc & 0xFFFF
23 | crc = (crc << 8) | ((crc >> 8) & 0xFF)
24 |
25 | return crc & 0xFFFF
26 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/crc16/crc16_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2018 Øystein Sture
2 | #
3 | # SPDX-License-Identifier: BSD-3-Clause
4 |
5 | import numpy as np
6 |
7 |
8 | # Adapted from https://gist.github.com/oysstu/68072c44c02879a2abf94ef350d1c7c6
9 | def crc16(data, poly=0x8408):
10 | """
11 | CRC-16-CCITT Algorithm
12 | """
13 | crc = 0xFFFF
14 | for b in data:
15 | cur_byte = 0xFF & b
16 | for _ in range(0, 8):
17 | if (crc & 0x0001) ^ (cur_byte & 0x0001):
18 | crc = (crc >> 1) ^ poly
19 | else:
20 | crc >>= 1
21 | cur_byte >>= 1
22 | crc = ~crc & 0xFFFF
23 | crc = (crc << 8) | ((crc >> 8) & 0xFF)
24 |
25 | return crc & 0xFFFF
26 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/deep_learning/conv2d_bias/conv2d.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(C_in, C_out, H, K, N, W):
10 | from numpy.random import default_rng
11 |
12 | rng = default_rng(42)
13 | # NHWC data layout
14 | input = rng.random((N, H, W, C_in), dtype=np.float32)
15 | # Weights
16 | weights = rng.random((K, K, C_in, C_out), dtype=np.float32)
17 | bias = rng.random((C_out,), dtype=np.float32)
18 | return input, weights, bias
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/deep_learning/resnet/resnet.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, W, H, C1, C2):
10 | from numpy.random import default_rng
11 |
12 | rng = default_rng(42)
13 |
14 | # Input
15 | input = rng.random((N, H, W, C1), dtype=np.float32)
16 | # Weights
17 | conv1 = rng.random((1, 1, C1, C2), dtype=np.float32)
18 | conv2 = rng.random((3, 3, C2, C2), dtype=np.float32)
19 | conv3 = rng.random((1, 1, C2, C1), dtype=np.float32)
20 | return (input, conv1, conv2, conv3)
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/deep_learning/softmax/softmax.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, H, SM):
10 | from numpy.random import default_rng
11 |
12 | rng = default_rng(42)
13 | x = rng.random((N, H, SM, SM), dtype=np.float32)
14 | return x
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/deep_learning/softmax/softmax_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import cupy as np
7 |
8 |
9 | # Numerically-stable version of softmax
10 | def softmax(x):
11 | tmp_max = np.max(x, axis=-1, keepdims=True)
12 | tmp_out = np.exp(x - tmp_max)
13 | tmp_sum = np.sum(tmp_out, axis=-1, keepdims=True)
14 | return tmp_out / tmp_sum
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/deep_learning/softmax/softmax_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import dpnp as np
7 |
8 |
9 | # Numerically-stable version of softmax
10 | def softmax(x):
11 | tmp_max = np.max(x, axis=-1, keepdims=True)
12 | tmp_out = np.exp(x - tmp_max)
13 | tmp_sum = np.sum(tmp_out, axis=-1, keepdims=True)
14 | return tmp_out / tmp_sum
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/deep_learning/softmax/softmax_numba_o.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numba as nb
7 | import numpy as np
8 |
9 |
10 | # Numerically-stable version of softmax
11 | @nb.jit(nopython=False, forceobj=True, parallel=False, fastmath=True)
12 | def softmax(x):
13 | tmp_max = np.max(x, axis=-1, keepdims=True)
14 | tmp_out = np.exp(x - tmp_max)
15 | tmp_sum = np.sum(tmp_out, axis=-1, keepdims=True)
16 | return tmp_out / tmp_sum
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/deep_learning/softmax/softmax_numba_op.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numba as nb
7 | import numpy as np
8 |
9 |
10 | # Numerically-stable version of softmax
11 | @nb.jit(nopython=False, forceobj=True, parallel=True, fastmath=True)
12 | def softmax(x):
13 | tmp_max = np.max(x, axis=-1, keepdims=True)
14 | tmp_out = np.exp(x - tmp_max)
15 | tmp_sum = np.sum(tmp_out, axis=-1, keepdims=True)
16 | return tmp_out / tmp_sum
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/deep_learning/softmax/softmax_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | # Numerically-stable version of softmax
10 | def softmax(x):
11 | tmp_max = np.max(x, axis=-1, keepdims=True)
12 | tmp_out = np.exp(x - tmp_max)
13 | tmp_sum = np.sum(tmp_out, axis=-1, keepdims=True)
14 | return tmp_out / tmp_sum
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/deep_learning/softmax/softmax_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | # Numerically-stable version of softmax
10 | # pythran export softmax(float32[:,:,:,:])
11 | def softmax(x):
12 | # tmp_max = np.max(x, axis=-1, keepdims=True)
13 | tmp_max = np.max(x, axis=-1)[:, :, :, np.newaxis]
14 | tmp_out = np.exp(x - tmp_max)
15 | # tmp_sum = np.sum(tmp_out, axis=-1, keepdims=True)
16 | tmp_sum = np.sum(tmp_out, axis=-1)[:, :, :, np.newaxis]
17 | return tmp_out / tmp_sum
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def initialize(N):
11 | from numpy.random import default_rng
12 |
13 | rng = default_rng(42)
14 | x = rng.random((N, N), dtype=np.float64)
15 | return x
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import cupy as np
10 |
11 |
12 | def go_fast(a):
13 | trace = 0.0
14 | for i in range(a.shape[0]):
15 | trace += np.tanh(a[i, i])
16 | return a + trace
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import dace as dc
10 | import numpy as np
11 |
12 | N = dc.symbol("N", dtype=dc.int64)
13 |
14 |
15 | @dc.program
16 | def go_fast(a: dc.float64[N, N]):
17 | trace = 0.0
18 | for i in range(N):
19 | trace += np.tanh(a[i, i])
20 | return a + trace
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import dpnp as np
10 |
11 |
12 | def go_fast(a):
13 | trace = 0.0
14 | for i in range(a.shape[0]):
15 | trace += np.tanh(a[i, i])
16 | return a + trace
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_legate.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import legate.numpy as np
10 |
11 |
12 | def go_fast(a):
13 | trace = 0.0
14 | for i in range(a.shape[0]):
15 | trace += np.tanh(a[i, i])
16 | return a + trace
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import dpnp as np
10 | from numba_dpex import dpjit
11 |
12 |
13 | @dpjit
14 | def go_fast(a):
15 | trace = 0.0
16 | for i in range(a.shape[0]):
17 | trace += np.tanh(a[i, i])
18 | return a + trace
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_numba_dpex_p.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import dpnp as np
10 | import numba as nb
11 | from numba_dpex import dpjit
12 |
13 |
14 | @dpjit
15 | def go_fast(a):
16 | trace = 0.0
17 | for i in nb.prange(a.shape[0]):
18 | trace += np.tanh(a[i, i])
19 | return a + trace
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import numba as nb
10 | import numpy as np
11 |
12 |
13 | @nb.jit(nopython=True, parallel=False, fastmath=True)
14 | def go_fast(a):
15 | trace = 0.0
16 | for i in range(a.shape[0]):
17 | trace += np.tanh(a[i, i])
18 | return a + trace
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import numba as nb
10 | import numpy as np
11 |
12 |
13 | @nb.jit(nopython=True, parallel=True, fastmath=True)
14 | def go_fast(a):
15 | trace = 0.0
16 | for i in range(a.shape[0]):
17 | trace += np.tanh(a[i, i])
18 | return a + trace
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_numba_npr.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import numba as nb
10 | import numpy as np
11 |
12 |
13 | @nb.jit(nopython=True, parallel=True, fastmath=True)
14 | def go_fast(a):
15 | trace = 0.0
16 | for i in nb.prange(a.shape[0]):
17 | trace += np.tanh(a[i, i])
18 | return a + trace
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import numpy as np
10 |
11 |
12 | def go_fast(a):
13 | trace = 0.0
14 | for i in range(a.shape[0]):
15 | trace += np.tanh(a[i, i])
16 | return a + trace
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/go_fast/go_fast_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2012-2020 Anaconda, Inc. and others
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | # https://numba.readthedocs.io/en/stable/user/5minguide.html
8 |
9 | import numpy as np
10 |
11 |
12 | # pythran export go_fast(float64[:])
13 | def go_fast(a):
14 | trace = 0.0
15 | for i in range(a.shape[0]):
16 | trace += np.tanh(a[i, i])
17 | return a + trace
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/nbody/nbody.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2020 Philip Mocz
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: GPL-3.0-or-later
6 |
7 | import numpy as np
8 |
9 |
10 | def initialize(N, tEnd, dt):
11 | from numpy.random import default_rng
12 |
13 | rng = default_rng(42)
14 | mass = 20.0 * np.ones((N, 1)) / N # total mass of particles is 20
15 | pos = rng.random((N, 3)) # randomly selected positions and velocities
16 | vel = rng.random((N, 3))
17 | Nt = int(np.ceil(tEnd / dt))
18 | return mass, pos, vel, Nt
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/pythran/arc_distance/arc_distance.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2019 Serge Guelton
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 |
8 | def initialize(N):
9 | from numpy.random import default_rng
10 |
11 | rng = default_rng(42)
12 | t0, p0, t1, p1 = (
13 | rng.random((N,)),
14 | rng.random((N,)),
15 | rng.random((N,)),
16 | rng.random((N,)),
17 | )
18 | return t0, p0, t1, p1
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/pythran/arc_distance/arc_distance_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2019 Serge Guelton
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def arc_distance(theta_1, phi_1, theta_2, phi_2):
11 | """
12 | Calculates the pairwise arc distance between all points in vector a and b.
13 | """
14 | temp = (
15 | np.sin((theta_2 - theta_1) / 2) ** 2
16 | + np.cos(theta_1) * np.cos(theta_2) * np.sin((phi_2 - phi_1) / 2) ** 2
17 | )
18 | distance_matrix = 2 * (np.arctan2(np.sqrt(temp), np.sqrt(1 - temp)))
19 | return distance_matrix
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/pythran/arc_distance/arc_distance_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2019 Serge Guelton
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def arc_distance(theta_1, phi_1, theta_2, phi_2):
11 | """
12 | Calculates the pairwise arc distance between all points in vector a and b.
13 | """
14 | temp = (
15 | np.sin((theta_2 - theta_1) / 2) ** 2
16 | + np.cos(theta_1) * np.cos(theta_2) * np.sin((phi_2 - phi_1) / 2) ** 2
17 | )
18 | distance_matrix = 2 * (np.arctan2(np.sqrt(temp), np.sqrt(1 - temp)))
19 | return distance_matrix
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/pythran/arc_distance/arc_distance_legate.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2019 Serge Guelton
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import legate.numpy as np
8 |
9 |
10 | def arc_distance(theta_1, phi_1, theta_2, phi_2):
11 | """
12 | Calculates the pairwise arc distance between all points in vector a and b.
13 | """
14 | temp = (
15 | np.sin((theta_2 - theta_1) / 2) ** 2
16 | + np.cos(theta_1) * np.cos(theta_2) * np.sin((phi_2 - phi_1) / 2) ** 2
17 | )
18 | distance_matrix = 2 * (np.arctan2(np.sqrt(temp), np.sqrt(1 - temp)))
19 | return distance_matrix
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/pythran/arc_distance/arc_distance_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2019 Serge Guelton
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def arc_distance(theta_1, phi_1, theta_2, phi_2):
11 | """
12 | Calculates the pairwise arc distance between all points in vector a and b.
13 | """
14 | temp = (
15 | np.sin((theta_2 - theta_1) / 2) ** 2
16 | + np.cos(theta_1) * np.cos(theta_2) * np.sin((phi_2 - phi_1) / 2) ** 2
17 | )
18 | distance_matrix = 2 * (np.arctan2(np.sqrt(temp), np.sqrt(1 - temp)))
19 | return distance_matrix
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/spmv/spmv_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | # Sparse Matrix-Vector Multiplication (SpMV)
7 | import cupy as np
8 |
9 |
10 | # Matrix-Vector Multiplication with the matrix given in Compressed Sparse Row
11 | # (CSR) format
12 | def spmv(A_row, A_col, A_val, x):
13 | y = np.empty(A_row.size - 1, A_val.dtype)
14 |
15 | for i in range(A_row.size - 1):
16 | cols = A_col[A_row[i] : A_row[i + 1]]
17 | vals = A_val[A_row[i] : A_row[i + 1]]
18 | y[i] = vals @ x[cols]
19 |
20 | return y
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/spmv/spmv_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | # Sparse Matrix-Vector Multiplication (SpMV)
7 | import dpnp as np
8 |
9 |
10 | # Matrix-Vector Multiplication with the matrix given in Compressed Sparse Row
11 | # (CSR) format
12 | def spmv(A_row, A_col, A_val, x):
13 | y = np.empty(A_row.size - 1, A_val.dtype)
14 |
15 | for i in range(A_row.size - 1):
16 | cols = A_col[A_row[i] : A_row[i + 1]]
17 | vals = A_val[A_row[i] : A_row[i + 1]]
18 | y[i] = vals @ x[cols]
19 |
20 | return y
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/spmv/spmv_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import dpnp as np
7 |
8 | # Sparse Matrix-Vector Multiplication (SpMV)
9 | from numba_dpex import dpjit
10 |
11 |
12 | # Matrix-Vector Multiplication with the matrix given in Compressed Sparse Row
13 | # (CSR) format
14 | @dpjit
15 | def spmv(A_row, A_col, A_val, x):
16 | y = np.empty(A_row.size - 1, A_val.dtype)
17 |
18 | for i in range(A_row.size - 1):
19 | cols = A_col[A_row[i] : A_row[i + 1]]
20 | vals = A_val[A_row[i] : A_row[i + 1]]
21 | y[i] = vals @ x[cols]
22 |
23 | return y
24 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/spmv/spmv_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | # Sparse Matrix-Vector Multiplication (SpMV)
7 | import numpy as np
8 |
9 |
10 | # Matrix-Vector Multiplication with the matrix given in Compressed Sparse Row
11 | # (CSR) format
12 | def spmv(A_row, A_col, A_val, x):
13 | y = np.empty(A_row.size - 1, A_val.dtype)
14 |
15 | for i in range(A_row.size - 1):
16 | cols = A_col[A_row[i] : A_row[i + 1]]
17 | vals = A_val[A_row[i] : A_row[i + 1]]
18 | y[i] = vals @ x[cols]
19 |
20 | return y
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/spmv/spmv_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | # Sparse Matrix-Vector Multiplication (SpMV)
7 | import numpy as np
8 |
9 |
10 | # Matrix-Vector Multiplication with the matrix given in Compressed Sparse Row
11 | # (CSR) format
12 | # pythran export spmv(uint32[:], uint32[:], float64[:], float64[:])
13 | def spmv(A_row, A_col, A_val, x):
14 | y = np.empty(A_row.size - 1, A_val.dtype)
15 |
16 | for i in range(A_row.size - 1):
17 | cols = A_col[A_row[i] : A_row[i + 1]]
18 | vals = A_val[A_row[i] : A_row[i + 1]]
19 | y[i] = vals @ x[cols]
20 |
21 | return y
22 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/stockham_fft/stockham_fft.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def rng_complex(shape, rng):
10 | return rng.random(shape) + rng.random(shape) * 1j
11 |
12 |
13 | def initialize(R, K):
14 | from numpy.random import default_rng
15 |
16 | rng = default_rng(42)
17 |
18 | N = R**K
19 | X = rng_complex((N,), rng)
20 | Y = np.zeros_like(X, dtype=np.complex128)
21 |
22 | return N, X, Y
23 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/npbench/weather_stencils/hdiff/hdiff.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2014-2021 ETH Zurich
2 | # SPDX-FileCopyrightText: 2007 Free Software Foundation, Inc.
3 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
4 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
5 | #
6 | # SPDX-License-Identifier: GPL-3.0-or-later
7 |
8 | import numpy as np
9 |
10 |
11 | def initialize(I, J, K): # noqa: E741 math variable
12 | from numpy.random import default_rng
13 |
14 | rng = default_rng(42)
15 |
16 | # Define arrays
17 | in_field = rng.random((I + 4, J + 4, K))
18 | out_field = rng.random((I, J, K))
19 | coeff = rng.random((I, J, K))
20 |
21 | return in_field, out_field, coeff
22 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/datamining/correlation/correlation.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(M, N, datatype=np.float64):
10 | float_n = datatype(N)
11 | data = np.fromfunction(lambda i, j: (i * j) / M + i, (N, M), dtype=datatype)
12 |
13 | return float_n, data
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/datamining/correlation/correlation_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(M, float_n, data):
11 | mean = np.mean(data, axis=0)
12 | stddev = np.std(data, axis=0)
13 | stddev[stddev <= 0.1] = 1.0
14 | data -= mean
15 | data /= np.sqrt(float_n) * stddev
16 | corr = np.eye(M, dtype=data.dtype)
17 | for i in range(M - 1):
18 | corr[i + 1 : M, i] = corr[i, i + 1 : M] = (
19 | data[:, i] @ data[:, i + 1 : M]
20 | )
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/datamining/covariance/covariance.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(M, N, datatype=np.float64):
10 | float_n = datatype(N)
11 | data = np.fromfunction(lambda i, j: (i * j) / M, (N, M), dtype=datatype)
12 |
13 | return float_n, data
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/datamining/covariance/covariance_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(M, float_n, data):
11 | mean = np.mean(data, axis=0)
12 | data -= mean
13 | cov = np.zeros((M, M), dtype=data.dtype)
14 | for i in range(M):
15 | cov[i:M, i] = cov[i, i:M] = data[:, i] @ data[:, i:M] / (float_n - 1.0)
16 |
17 | return cov
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/datamining/covariance/covariance_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(M, float_n, data):
11 | mean = np.mean(data, axis=0)
12 | data -= mean
13 | cov = np.zeros((M, M), dtype=data.dtype)
14 | for i in range(M):
15 | cov[i:M, i] = cov[i, i:M] = data[:, i] @ data[:, i:M] / (float_n - 1.0)
16 |
17 | return cov
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemm/gemm_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(alpha, beta, C, A, B):
11 | with np.cuda.Device(0):
12 | C[:] = alpha * A @ B + beta * C
13 |
14 | # with cp.cuda.Device(0):
15 |
16 | # g_A = cp.asarray(A)
17 | # g_B = cp.asarray(B)
18 | # g_C = cp.asarray(C)
19 |
20 | # g_C[:] = g_alpha * g_A @ g_B + g_beta * g_C
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemm/gemm_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | NI, NJ, NK = (dc.symbol(s, dtype=dc.int64) for s in ("NI", "NJ", "NK"))
11 |
12 |
13 | @dc.program
14 | def kernel(
15 | alpha: dc.float64,
16 | beta: dc.float64,
17 | C: dc.float64[NI, NJ],
18 | A: dc.float64[NI, NK],
19 | B: dc.float64[NK, NJ],
20 | ):
21 | C[:] = alpha * A @ B + beta * C
22 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemm/gemm_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(alpha, beta, C, A, B):
11 | C[:] = alpha * A @ B + beta * C
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemm/gemm_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(alpha, beta, C, A, B):
13 | C[:] = alpha * A @ B + beta * C
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemm/gemm_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(alpha, beta, C, A, B):
13 | C[:] = alpha * A @ B + beta * C
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemm/gemm_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(alpha, beta, C, A, B):
13 | C[:] = alpha * A @ B + beta * C
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemm/gemm_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(alpha, beta, C, A, B):
11 | C[:] = alpha * A @ B + beta * C
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemm/gemm_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64, float64, float64[:,:], float64[:,:], float64[:,:])
11 | def kernel(alpha, beta, C, A, B):
12 | C[:] = alpha * A @ B + beta * C
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemver/gemver_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(alpha, beta, A, u1, v1, u2, v2, w, x, y, z):
11 | A += np.outer(u1, v1) + np.outer(u2, v2)
12 | x += beta * y @ A + z
13 | w += alpha * A @ x
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemver/gemver_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(alpha, beta, A, u1, v1, u2, v2, w, x, y, z):
11 | A += np.outer(u1, v1) + np.outer(u2, v2)
12 | x += beta * y @ A + z
13 | w += alpha * A @ x
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemver/gemver_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(alpha, beta, A, u1, v1, u2, v2, w, x, y, z):
13 | A += np.outer(u1, v1) + np.outer(u2, v2)
14 | x += beta * y @ A + z
15 | w += alpha * A @ x
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemver/gemver_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(alpha, beta, A, u1, v1, u2, v2, w, x, y, z):
13 | A += np.outer(u1, v1) + np.outer(u2, v2)
14 | x += beta * y @ A + z
15 | w += alpha * A @ x
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemver/gemver_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(alpha, beta, A, u1, v1, u2, v2, w, x, y, z):
13 | A += np.outer(u1, v1) + np.outer(u2, v2)
14 | x += beta * y @ A + z
15 | w += alpha * A @ x
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemver/gemver_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(alpha, beta, A, u1, v1, u2, v2, w, x, y, z):
11 | A += np.outer(u1, v1) + np.outer(u2, v2)
12 | x += beta * y @ A + z
13 | w += alpha * A @ x
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gemver/gemver_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64, float64, float64[:,:], float64[:], float64[:], float64[:], float64[:], float64[:], float64[:], float64[:], float64[:])
11 | def kernel(alpha, beta, A, u1, v1, u2, v2, w, x, y, z):
12 | A += np.outer(u1, v1) + np.outer(u2, v2)
13 | x += beta * y @ A + z
14 | w += alpha * A @ x
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gesummv/gesummv.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | alpha = datatype(1.5)
11 | beta = datatype(1.2)
12 | A = np.fromfunction(
13 | lambda i, j: ((i * j + 1) % N) / N, (N, N), dtype=datatype
14 | )
15 | B = np.fromfunction(
16 | lambda i, j: ((i * j + 2) % N) / N, (N, N), dtype=datatype
17 | )
18 | x = np.fromfunction(lambda i: (i % N) / N, (N,), dtype=datatype)
19 |
20 | return alpha, beta, A, B, x
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gesummv/gesummv_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(alpha, beta, A, B, x):
11 | return alpha * A @ x + beta * B @ x
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gesummv/gesummv_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | N = dc.symbol("N", dtype=dc.int64)
11 |
12 |
13 | @dc.program
14 | def kernel(
15 | alpha: dc.float64,
16 | beta: dc.float64,
17 | A: dc.float64[N, N],
18 | B: dc.float64[N, N],
19 | x: dc.float64[N],
20 | ):
21 | return alpha * A @ x + beta * B @ x
22 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gesummv/gesummv_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(alpha, beta, A, B, x):
11 | return alpha * A @ x + beta * B @ x
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gesummv/gesummv_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(alpha, beta, A, B, x):
13 | return alpha * A @ x + beta * B @ x
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gesummv/gesummv_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(alpha, beta, A, B, x):
13 | return alpha * A @ x + beta * B @ x
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gesummv/gesummv_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(alpha, beta, A, B, x):
13 | return alpha * A @ x + beta * B @ x
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gesummv/gesummv_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(alpha, beta, A, B, x):
11 | return alpha * A @ x + beta * B @ x
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/gesummv/gesummv_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64, float64, float64[:,:], float64[:,:], float64[:])
11 | def kernel(alpha, beta, A, B, x):
12 | return alpha * A @ x + beta * B @ x
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/symm/symm_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(alpha, beta, C, A, B):
11 | temp2 = np.empty((C.shape[1],), dtype=C.dtype)
12 | C *= beta
13 | for i in range(C.shape[0]):
14 | for j in range(C.shape[1]):
15 | C[:i, j] += alpha * B[i, j] * A[i, :i]
16 | temp2[j] = B[:i, j] @ A[i, :i]
17 | C[i, :] += alpha * B[i, :] * A[i, i] + alpha * temp2
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/symm/symm_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(alpha, beta, C, A, B):
11 | temp2 = np.empty((C.shape[1],), dtype=C.dtype)
12 | C *= beta
13 | for i in range(C.shape[0]):
14 | for j in range(C.shape[1]):
15 | C[:i, j] += alpha * B[i, j] * A[i, :i]
16 | temp2[j] = B[:i, j] @ A[i, :i]
17 | C[i, :] += alpha * B[i, :] * A[i, i] + alpha * temp2
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/symm/symm_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(alpha, beta, C, A, B):
11 | temp2 = np.empty((C.shape[1],), dtype=C.dtype)
12 | C *= beta
13 | for i in range(C.shape[0]):
14 | for j in range(C.shape[1]):
15 | C[:i, j] += alpha * B[i, j] * A[i, :i]
16 | temp2[j] = B[:i, j] @ A[i, :i]
17 | C[i, :] += alpha * B[i, :] * A[i, i] + alpha * temp2
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syr2k/syr2k.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(M, N, datatype=np.float64):
10 | alpha = datatype(1.5)
11 | beta = datatype(1.2)
12 | C = np.fromfunction(
13 | lambda i, j: ((i * j + 3) % N) / M, (N, N), dtype=datatype
14 | )
15 | A = np.fromfunction(
16 | lambda i, j: ((i * j + 1) % N) / N, (N, M), dtype=datatype
17 | )
18 | B = np.fromfunction(
19 | lambda i, j: ((i * j + 2) % M) / M, (N, M), dtype=datatype
20 | )
21 |
22 | return alpha, beta, C, A, B
23 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syr2k/syr2k_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(alpha, beta, C, A, B):
11 | for i in range(A.shape[0]):
12 | C[i, : i + 1] *= beta
13 | for k in range(A.shape[1]):
14 | C[i, : i + 1] += (
15 | A[: i + 1, k] * alpha * B[i, k]
16 | + B[: i + 1, k] * alpha * A[i, k]
17 | )
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syr2k/syr2k_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(alpha, beta, C, A, B):
11 | for i in range(A.shape[0]):
12 | C[i, : i + 1] *= beta
13 | for k in range(A.shape[1]):
14 | C[i, : i + 1] += (
15 | A[: i + 1, k] * alpha * B[i, k]
16 | + B[: i + 1, k] * alpha * A[i, k]
17 | )
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syr2k/syr2k_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(alpha, beta, C, A, B):
13 | for i in range(A.shape[0]):
14 | C[i, : i + 1] *= beta
15 | for k in range(A.shape[1]):
16 | C[i, : i + 1] += (
17 | A[: i + 1, k] * alpha * B[i, k]
18 | + B[: i + 1, k] * alpha * A[i, k]
19 | )
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syr2k/syr2k_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(alpha, beta, C, A, B):
11 | for i in range(A.shape[0]):
12 | C[i, : i + 1] *= beta
13 | for k in range(A.shape[1]):
14 | C[i, : i + 1] += (
15 | A[: i + 1, k] * alpha * B[i, k]
16 | + B[: i + 1, k] * alpha * A[i, k]
17 | )
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syr2k/syr2k_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64, float64, float64[:,:], float64[:,:], float64[:,:])
11 | def kernel(alpha, beta, C, A, B):
12 | for i in range(A.shape[0]):
13 | C[i, : i + 1] *= beta
14 | for k in range(A.shape[1]):
15 | C[i, : i + 1] += (
16 | A[: i + 1, k] * alpha * B[i, k]
17 | + B[: i + 1, k] * alpha * A[i, k]
18 | )
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syrk/syrk.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(M, N, datatype=np.float64):
10 | alpha = datatype(1.5)
11 | beta = datatype(1.2)
12 | C = np.fromfunction(
13 | lambda i, j: ((i * j + 2) % N) / M, (N, N), dtype=datatype
14 | )
15 | A = np.fromfunction(
16 | lambda i, j: ((i * j + 1) % N) / N, (N, M), dtype=datatype
17 | )
18 |
19 | return alpha, beta, C, A
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syrk/syrk_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(alpha, beta, C, A):
11 | for i in range(A.shape[0]):
12 | C[i, : i + 1] *= beta
13 | for k in range(A.shape[1]):
14 | C[i, : i + 1] += alpha * A[i, k] * A[: i + 1, k]
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syrk/syrk_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | M, N = (dc.symbol(s, dtype=dc.int64) for s in ("M", "N"))
11 |
12 |
13 | @dc.program
14 | def kernel(
15 | alpha: dc.float64,
16 | beta: dc.float64,
17 | C: dc.float64[N, N],
18 | A: dc.float64[N, M],
19 | ):
20 | for i in range(N):
21 | C[i, : i + 1] *= beta
22 | for k in range(M):
23 | C[i, : i + 1] += alpha * A[i, k] * A[: i + 1, k]
24 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syrk/syrk_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(alpha, beta, C, A):
11 | for i in range(A.shape[0]):
12 | C[i, : i + 1] *= beta
13 | for k in range(A.shape[1]):
14 | C[i, : i + 1] += alpha * A[i, k] * A[: i + 1, k]
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syrk/syrk_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(alpha, beta, C, A):
13 | for i in range(A.shape[0]):
14 | C[i, : i + 1] *= beta
15 | for k in range(A.shape[1]):
16 | C[i, : i + 1] += alpha * A[i, k] * A[: i + 1, k]
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syrk/syrk_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(alpha, beta, C, A):
11 | for i in range(A.shape[0]):
12 | C[i, : i + 1] *= beta
13 | for k in range(A.shape[1]):
14 | C[i, : i + 1] += alpha * A[i, k] * A[: i + 1, k]
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/syrk/syrk_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64, float64, float64[:,:], float64[:,:])
11 | def kernel(alpha, beta, C, A):
12 | for i in range(A.shape[0]):
13 | C[i, : i + 1] *= beta
14 | for k in range(A.shape[1]):
15 | C[i, : i + 1] += alpha * A[i, k] * A[: i + 1, k]
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/trmm/trmm.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(M, N, datatype=np.float64):
10 | alpha = datatype(1.5)
11 | A = np.fromfunction(lambda i, j: ((i * j) % M) / M, (M, M), dtype=datatype)
12 | for i in range(M):
13 | A[i, i] = 1.0
14 | B = np.fromfunction(
15 | lambda i, j: ((N + i - j) % N) / N, (M, N), dtype=datatype
16 | )
17 |
18 | return alpha, A, B
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/trmm/trmm_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(alpha, A, B):
11 | for i in range(B.shape[0]):
12 | for j in range(B.shape[1]):
13 | B[i, j] += np.dot(A[i + 1 :, i], B[i + 1 :, j])
14 | B *= alpha
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/trmm/trmm_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(alpha, A, B):
11 | for i in range(B.shape[0]):
12 | for j in range(B.shape[1]):
13 | B[i, j] += np.dot(A[i + 1 :, i], B[i + 1 :, j])
14 | B *= alpha
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/trmm/trmm_numba_dpex_p.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | import numba as nb
9 | from numba_dpex import dpjit
10 |
11 |
12 | @dpjit
13 | def kernel(alpha, A, B):
14 | for i in range(B.shape[0]):
15 | for j in nb.prange(B.shape[1]):
16 | B[i, j] += np.dot(A[i + 1 :, i], B[i + 1 :, j])
17 | B *= alpha
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/trmm/trmm_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(alpha, A, B):
13 | for i in range(B.shape[0]):
14 | for j in range(B.shape[1]):
15 | B[i, j] += np.dot(A[i + 1 :, i], B[i + 1 :, j])
16 | B *= alpha
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/trmm/trmm_numba_npr.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(alpha, A, B):
13 | for i in range(B.shape[0]):
14 | for j in nb.prange(B.shape[1]):
15 | B[i, j] += np.dot(A[i + 1 :, i], B[i + 1 :, j])
16 | B *= alpha
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/trmm/trmm_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(alpha, A, B):
11 | for i in range(B.shape[0]):
12 | for j in range(B.shape[1]):
13 | B[i, j] += np.dot(A[i + 1 :, i], B[i + 1 :, j])
14 | B *= alpha
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/blas/trmm/trmm_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64, float64[:,:], float64[:,:])
11 | def kernel(alpha, A, B):
12 | for i in range(B.shape[0]):
13 | for j in range(B.shape[1]):
14 | B[i, j] += np.dot(A[i + 1 :, i], B[i + 1 :, j])
15 | B *= alpha
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/atax/atax.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(M, N, datatype=np.float64):
10 | fn = datatype(N)
11 | x = np.fromfunction(lambda i: 1 + (i / fn), (N,), dtype=datatype)
12 | A = np.fromfunction(
13 | lambda i, j: ((i + j) % N) / (5 * M), (M, N), dtype=datatype
14 | )
15 |
16 | return x, A
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/atax/atax_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(A, x):
11 | return (A @ x) @ A
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/atax/atax_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | M, N = (dc.symbol(s, dtype=dc.int64) for s in ("M", "N"))
11 |
12 |
13 | @dc.program
14 | def kernel(A: dc.float64[M, N], x: dc.float64[N]):
15 | return (A @ x) @ A
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/atax/atax_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(A, x):
11 | return (A @ x) @ A
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/atax/atax_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(A, x):
13 | return (A @ x) @ A
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/atax/atax_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(A, x):
13 | return (A @ x) @ A
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/atax/atax_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(A, x):
13 | return (A @ x) @ A
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/atax/atax_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(A, x):
11 | return (A @ x) @ A
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/atax/atax_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64[:,:], float64[:])
11 | def kernel(A, x):
12 | return (A @ x) @ A
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/bicg/bicg.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(M, N, datatype=np.float64):
10 | A = np.fromfunction(
11 | lambda i, j: (i * (j + 1) % N) / N, (N, M), dtype=datatype
12 | )
13 | p = np.fromfunction(lambda i: (i % M) / M, (M,), dtype=datatype)
14 | r = np.fromfunction(lambda i: (i % N) / N, (N,), dtype=datatype)
15 |
16 | return A, p, r
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/bicg/bicg_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(A, p, r):
11 | return r @ A, A @ p
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/bicg/bicg_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | M, N = (dc.symbol(s, dtype=dc.int64) for s in ("M", "N"))
11 |
12 |
13 | @dc.program
14 | def kernel(A: dc.float64[N, M], p: dc.float64[M], r: dc.float64[N]):
15 | return r @ A, A @ p
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/bicg/bicg_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(A, p, r):
11 | return r @ A, A @ p
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/bicg/bicg_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(A, p, r):
13 | return r @ A, A @ p
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/bicg/bicg_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(A, p, r):
13 | return r @ A, A @ p
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/bicg/bicg_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(A, p, r):
13 | return r @ A, A @ p
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/bicg/bicg_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(A, p, r):
11 | return r @ A, A @ p
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/bicg/bicg_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64[:,:], float64[:], float64[:])
11 | def kernel(A, p, r):
12 | return r @ A, A @ p
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/doitgen/doitgen.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def initialize(NR, NQ, NP, datatype=np.float64):
11 | A = np.fromfunction(
12 | lambda i, j, k: ((i * j + k) % NP) / NP, (NR, NQ, NP), dtype=datatype
13 | )
14 | C4 = np.fromfunction(
15 | lambda i, j: (i * j % NP) / NP, (NP, NP), dtype=datatype
16 | )
17 |
18 | return A, C4
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/doitgen/doitgen_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(NR, NQ, NP, A, C4):
11 | # for r in range(NR):
12 | # for q in range(NQ):
13 | # sum[:] = A[r, q, :] @ C4
14 | # A[r, q, :] = sum
15 | A[:] = np.reshape(np.reshape(A, (NR, NQ, 1, NP)) @ C4, (NR, NQ, NP))
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/doitgen/doitgen_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(NR, NQ, NP, A, C4):
11 | # for r in range(NR):
12 | # for q in range(NQ):
13 | # sum[:] = A[r, q, :] @ C4
14 | # A[r, q, :] = sum
15 | A[:] = np.reshape(np.reshape(A, (NR, NQ, 1, NP)) @ C4, (NR, NQ, NP))
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/doitgen/doitgen_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(NR, NQ, NP, A, C4):
13 | for r in range(NR):
14 | for q in range(NQ):
15 | tmp = A[r, q, :] @ C4
16 | A[r, q, :] = tmp
17 | # A[:] = np.reshape(np.reshape(A, (NR, NQ, 1, NP)) @ C4, (NR, NQ, NP))
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/doitgen/doitgen_numba_o.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=False, forceobj=True, parallel=False, fastmath=True)
12 | def kernel(NR, NQ, NP, A, C4):
13 | A[:] = np.reshape(np.reshape(A, (NR, NQ, 1, NP)) @ C4, (NR, NQ, NP))
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/doitgen/doitgen_numba_op.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=False, forceobj=True, parallel=True, fastmath=True)
12 | def kernel(NR, NQ, NP, A, C4):
13 | A[:] = np.reshape(np.reshape(A, (NR, NQ, 1, NP)) @ C4, (NR, NQ, NP))
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/doitgen/doitgen_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(NR, NQ, NP, A, C4):
11 | # for r in range(NR):
12 | # for q in range(NQ):
13 | # sum[:] = A[r, q, :] @ C4
14 | # A[r, q, :] = sum
15 | A[:] = np.reshape(np.reshape(A, (NR, NQ, 1, NP)) @ C4, (NR, NQ, NP))
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/doitgen/doitgen_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(int, int, int, float64[:,:,:], float64[:,:])
11 | def kernel(NR, NQ, NP, A, C4):
12 | # A[:] = np.reshape(np.reshape(A, (NR, NQ, 1, NP)) @ C4, (NR, NQ, NP))
13 | A[:] = (A.reshape(NR, NQ, 1, NP) @ C4).reshape(NR, NQ, NP)
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k2mm/k2mm_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(alpha, beta, A, B, C, D):
11 | D[:] = alpha * A @ B @ C + beta * D
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k2mm/k2mm_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | NI, NJ, NK, NL = (
11 | dc.symbol(s, dtype=dc.int64) for s in ("NI", "NJ", "NK", "NL")
12 | )
13 |
14 |
15 | @dc.program
16 | def kernel(
17 | alpha: dc.float64,
18 | beta: dc.float64,
19 | A: dc.float64[NI, NK],
20 | B: dc.float64[NK, NJ],
21 | C: dc.float64[NJ, NL],
22 | D: dc.float64[NI, NL],
23 | ):
24 | D[:] = alpha * A @ B @ C + beta * D
25 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k2mm/k2mm_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(alpha, beta, A, B, C, D):
11 | D[:] = alpha * A @ B @ C + beta * D
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k2mm/k2mm_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(alpha, beta, A, B, C, D):
13 | D[:] = alpha * A @ B @ C + beta * D
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k2mm/k2mm_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(alpha, beta, A, B, C, D):
13 | D[:] = alpha * A @ B @ C + beta * D
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k2mm/k2mm_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(alpha, beta, A, B, C, D):
13 | D[:] = alpha * A @ B @ C + beta * D
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k2mm/k2mm_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(alpha, beta, A, B, C, D):
11 | D[:] = alpha * A @ B @ C + beta * D
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k2mm/k2mm_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64, float64, float64[:,:], float64[:,:], float64[:,:], float64[:,:])
11 | def kernel(alpha, beta, A, B, C, D):
12 | D[:] = alpha * A @ B @ C + beta * D
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k3mm/k3mm_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(A, B, C, D):
11 | return A @ B @ C @ D
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k3mm/k3mm_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | NI, NJ, NK, NL, NM = (
11 | dc.symbol(s, dtype=dc.int64) for s in ("NI", "NJ", "NK", "NL", "NM")
12 | )
13 |
14 |
15 | @dc.program
16 | def kernel(
17 | A: dc.float64[NI, NK],
18 | B: dc.float64[NK, NJ],
19 | C: dc.float64[NJ, NM],
20 | D: dc.float64[NM, NL],
21 | ):
22 | return A @ B @ C @ D
23 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k3mm/k3mm_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(A, B, C, D):
11 | return A @ B @ C @ D
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k3mm/k3mm_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(A, B, C, D):
13 | return A @ B @ C @ D
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k3mm/k3mm_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(A, B, C, D):
13 | return A @ B @ C @ D
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k3mm/k3mm_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(A, B, C, D):
13 | return A @ B @ C @ D
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k3mm/k3mm_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(A, B, C, D):
11 | return A @ B @ C @ D
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/k3mm/k3mm_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64[:,:], float64[:,:], float64[:,:], float64[:,:])
11 | def kernel(A, B, C, D):
12 | return A @ B @ C @ D
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/mvt/mvt.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | x1 = np.fromfunction(lambda i: (i % N) / N, (N,), dtype=datatype)
11 | x2 = np.fromfunction(lambda i: ((i + 1) % N) / N, (N,), dtype=datatype)
12 | y_1 = np.fromfunction(lambda i: ((i + 3) % N) / N, (N,), dtype=datatype)
13 | y_2 = np.fromfunction(lambda i: ((i + 4) % N) / N, (N,), dtype=datatype)
14 | A = np.fromfunction(lambda i, j: (i * j % N) / N, (N, N), dtype=datatype)
15 |
16 | return x1, x2, y_1, y_2, A
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/mvt/mvt_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(x1, x2, y_1, y_2, A):
11 | x1 += A @ y_1
12 | x2 += y_2 @ A
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/mvt/mvt_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | N = dc.symbol("N", dtype=dc.int64)
11 |
12 |
13 | @dc.program
14 | def kernel(
15 | x1: dc.float64[N],
16 | x2: dc.float64[N],
17 | y_1: dc.float64[N],
18 | y_2: dc.float64[N],
19 | A: dc.float64[N, N],
20 | ):
21 | x1 += A @ y_1
22 | x2 += y_2 @ A
23 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/mvt/mvt_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(x1, x2, y_1, y_2, A):
11 | x1 += A @ y_1
12 | x2 += y_2 @ A
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/mvt/mvt_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(x1, x2, y_1, y_2, A):
13 | x1 += A @ y_1
14 | x2 += y_2 @ A
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/mvt/mvt_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(x1, x2, y_1, y_2, A):
13 | x1 += A @ y_1
14 | x2 += y_2 @ A
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/mvt/mvt_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 | nb.jit(nopython=True, parallel=True, fastmath=True)
11 |
12 |
13 | def kernel(x1, x2, y_1, y_2, A):
14 | x1 += A @ y_1
15 | x2 += y_2 @ A
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/mvt/mvt_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(x1, x2, y_1, y_2, A):
11 | x1 += A @ y_1
12 | x2 += y_2 @ A
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/kernels/mvt/mvt_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64[:], float64[:], float64[:], float64[:], float64[:,:])
11 | def kernel(x1, x2, y_1, y_2, A):
12 | x1 += A @ y_1
13 | x2 += y_2 @ A
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky/cholesky.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | A = np.empty((N, N), dtype=datatype)
11 | for i in range(N):
12 | A[i, : i + 1] = np.fromfunction(
13 | lambda j: (-j % N) / N + 1, (i + 1,), dtype=datatype
14 | )
15 | A[i, i + 1 :] = 0.0
16 | A[i, i] = 1.0
17 | A[:] = A @ np.transpose(A)
18 |
19 | return A
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky/cholesky_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(A):
11 | A[0, 0] = np.sqrt(A[0, 0])
12 | for i in range(1, A.shape[0]):
13 | for j in range(i):
14 | A[i, j] -= np.dot(A[i, :j], A[j, :j])
15 | A[i, j] /= A[j, j]
16 | A[i, i] -= np.dot(A[i, :i], A[i, :i])
17 | A[i, i] = np.sqrt(A[i, i])
18 |
19 |
20 | def kernel2(A):
21 | A[:] = np.linalg.cholesky(A) + np.triu(A, k=1)
22 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky/cholesky_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(A):
11 | A[0, 0] = np.sqrt(A[0, 0])
12 | for i in range(1, A.shape[0]):
13 | for j in range(i):
14 | A[i, j] -= np.dot(A[i, :j], A[j, :j])
15 | A[i, j] /= A[j, j]
16 | A[i, i] -= np.dot(A[i, :i], A[i, :i])
17 | A[i, i] = np.sqrt(A[i, i])
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky/cholesky_numba_dpex_p.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | import numba as nb
9 | from numba_dpex import dpjit
10 |
11 |
12 | @dpjit
13 | def kernel(A):
14 | A[0, 0] = np.sqrt(A[0, 0])
15 | for i in range(1, A.shape[0]):
16 | for j in nb.prange(i):
17 | A[i, j] -= np.dot(A[i, :j], A[j, :j])
18 | A[i, j] /= A[j, j]
19 | A[i, i] -= np.dot(A[i, :i], A[i, :i])
20 | A[i, i] = np.sqrt(A[i, i])
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky/cholesky_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(A):
13 | A[0, 0] = np.sqrt(A[0, 0])
14 | for i in range(1, A.shape[0]):
15 | for j in range(i):
16 | A[i, j] -= np.dot(A[i, :j], A[j, :j])
17 | A[i, j] /= A[j, j]
18 | A[i, i] -= np.dot(A[i, :i], A[i, :i])
19 | A[i, i] = np.sqrt(A[i, i])
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky/cholesky_numba_npr.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(A):
13 | A[0, 0] = np.sqrt(A[0, 0])
14 | for i in range(1, A.shape[0]):
15 | for j in nb.prange(i):
16 | A[i, j] -= np.dot(A[i, :j], A[j, :j])
17 | A[i, j] /= A[j, j]
18 | A[i, i] -= np.dot(A[i, :i], A[i, :i])
19 | A[i, i] = np.sqrt(A[i, i])
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky/cholesky_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(A):
11 | A[0, 0] = np.sqrt(A[0, 0])
12 | for i in range(1, A.shape[0]):
13 | for j in range(i):
14 | A[i, j] -= np.dot(A[i, :j], A[j, :j])
15 | A[i, j] /= A[j, j]
16 | A[i, i] -= np.dot(A[i, :i], A[i, :i])
17 | A[i, i] = np.sqrt(A[i, i])
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky2/cholesky2.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | A = np.empty((N, N), dtype=datatype)
11 | for i in range(N):
12 | A[i, : i + 1] = np.fromfunction(
13 | lambda j: (-j % N) / N + 1, (i + 1,), dtype=datatype
14 | )
15 | A[i, i + 1 :] = 0.0
16 | A[i, i] = 1.0
17 | A[:] = A @ np.transpose(A)
18 |
19 | return A
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky2/cholesky2_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(A):
11 | A[:] = np.linalg.cholesky(A) + np.triu(A, k=1)
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky2/cholesky2_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(A):
11 | A[:] = np.linalg.cholesky(A) + np.triu(A, k=1)
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky2/cholesky2_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(A):
13 | A[:] = np.linalg.cholesky(A) + np.triu(A, k=1)
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky2/cholesky2_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(A):
13 | A[:] = np.linalg.cholesky(A) + np.triu(A, k=1)
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky2/cholesky2_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(A):
13 | A[:] = np.linalg.cholesky(A) + np.triu(A, k=1)
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky2/cholesky2_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(A):
11 | A[:] = np.linalg.cholesky(A) + np.triu(A, k=1)
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/cholesky2/cholesky2_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64[:,:])
11 | def kernel2(A):
12 | A[:] = np.linalg.cholesky(A) + np.triu(A, k=1)
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/durbin/durbin.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | r = np.fromfunction(lambda i: N + 1 - i, (N,), dtype=datatype)
11 | return r
12 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/durbin/durbin_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(r):
11 | y = np.empty_like(r)
12 | alpha = -r[0]
13 | beta = 1.0
14 | y[0] = -r[0]
15 |
16 | for k in range(1, r.shape[0]):
17 | beta *= 1.0 - alpha * alpha
18 | alpha = -(r[k] + np.dot(np.flip(r[:k]), y[:k])) / beta
19 | y[:k] += alpha * np.flip(y[:k])
20 | y[k] = alpha
21 |
22 | return y
23 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/durbin/durbin_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(r):
11 | y = np.empty_like(r)
12 | alpha = -r[0]
13 | beta = 1.0
14 | y[0] = -r[0]
15 |
16 | for k in range(1, r.shape[0]):
17 | beta *= 1.0 - alpha * alpha
18 | alpha = -(r[k] + np.dot(np.flip(r[:k]), y[:k])) / beta
19 | y[:k] += alpha * np.flip(y[:k])
20 | y[k] = alpha
21 |
22 | return y
23 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/durbin/durbin_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(r):
11 | y = np.empty_like(r)
12 | alpha = -r[0]
13 | beta = 1.0
14 | y[0] = -r[0]
15 |
16 | for k in range(1, r.shape[0]):
17 | beta *= 1.0 - alpha * alpha
18 | alpha = -(r[k] + np.dot(np.flip(r[:k]), y[:k])) / beta
19 | y[:k] += alpha * np.flip(y[:k])
20 | y[k] = alpha
21 |
22 | return y
23 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/gramschmidt/gramschmidt.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(M, N, datatype=np.float64):
10 | from numpy.random import default_rng
11 |
12 | rng = default_rng(42)
13 |
14 | A = rng.random((M, N), dtype=datatype)
15 | while np.linalg.matrix_rank(A) < N:
16 | A = rng.random((M, N), dtype=datatype)
17 |
18 | return A
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/lu/lu.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | A = np.empty((N, N), dtype=datatype)
11 | for i in range(N):
12 | A[i, : i + 1] = np.fromfunction(
13 | lambda j: (-j % N) / N + 1, (i + 1,), dtype=datatype
14 | )
15 | A[i, i + 1 :] = 0.0
16 | A[i, i] = 1.0
17 | A[:] = A @ np.transpose(A)
18 |
19 | return A
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/lu/lu_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(A):
11 | for i in range(A.shape[0]):
12 | for j in range(i):
13 | A[i, j] -= A[i, :j] @ A[:j, j]
14 | A[i, j] /= A[j, j]
15 | for j in range(i, A.shape[0]):
16 | A[i, j] -= A[i, :i] @ A[:i, j]
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/lu/lu_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | N = dc.symbol("N", dtype=dc.int64)
11 |
12 |
13 | @dc.program
14 | def kernel(A: dc.float64[N, N]):
15 | for i in range(N):
16 | for j in range(i):
17 | A[i, j] -= A[i, :j] @ A[:j, j]
18 | A[i, j] /= A[j, j]
19 | for j in range(i, N):
20 | A[i, j] -= A[i, :i] @ A[:i, j]
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/lu/lu_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(A):
11 | for i in range(A.shape[0]):
12 | for j in range(i):
13 | A[i, j] -= A[i, :j] @ A[:j, j]
14 | A[i, j] /= A[j, j]
15 | for j in range(i, A.shape[0]):
16 | A[i, j] -= A[i, :i] @ A[:i, j]
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/lu/lu_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(A):
13 | for i in range(A.shape[0]):
14 | for j in range(i):
15 | A[i, j] -= A[i, :j] @ A[:j, j]
16 | A[i, j] /= A[j, j]
17 | for j in range(i, A.shape[0]):
18 | A[i, j] -= A[i, :i] @ A[:i, j]
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/lu/lu_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(A):
13 | for i in range(A.shape[0]):
14 | for j in range(i):
15 | A[i, j] -= A[i, :j] @ A[:j, j]
16 | A[i, j] /= A[j, j]
17 | for j in range(i, A.shape[0]):
18 | A[i, j] -= A[i, :i] @ A[:i, j]
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/lu/lu_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 | nb.jit(nopython=True, parallel=True, fastmath=True)
11 |
12 |
13 | def kernel(A):
14 | for i in range(A.shape[0]):
15 | for j in range(i):
16 | A[i, j] -= A[i, :j] @ A[:j, j]
17 | A[i, j] /= A[j, j]
18 | for j in range(i, A.shape[0]):
19 | A[i, j] -= A[i, :i] @ A[:i, j]
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/lu/lu_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(A):
11 | for i in range(A.shape[0]):
12 | for j in range(i):
13 | A[i, j] -= A[i, :j] @ A[:j, j]
14 | A[i, j] /= A[j, j]
15 | for j in range(i, A.shape[0]):
16 | A[i, j] -= A[i, :i] @ A[:i, j]
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/lu/lu_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64[:,:])
11 | def kernel(A):
12 | for i in range(A.shape[0]):
13 | for j in range(i):
14 | A[i, j] -= A[i, :j] @ A[:j, j]
15 | A[i, j] /= A[j, j]
16 | for j in range(i, A.shape[0]):
17 | A[i, j] -= A[i, :i] @ A[:i, j]
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/trisolv/trisolv.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | L = np.fromfunction(
11 | lambda i, j: (i + N - j + 1) * 2 / N, (N, N), dtype=datatype
12 | )
13 | x = np.full((N,), -999, dtype=datatype)
14 | b = np.fromfunction(lambda i: i, (N,), dtype=datatype)
15 |
16 | return L, x, b
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/trisolv/trisolv_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(L, x, b):
11 | for i in range(x.shape[0]):
12 | x[i] = (b[i] - L[i, :i] @ x[:i]) / L[i, i]
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/trisolv/trisolv_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | N = dc.symbol("N", dtype=dc.int64)
11 |
12 |
13 | @dc.program
14 | def kernel(L: dc.float64[N, N], x: dc.float64[N], b: dc.float64[N]):
15 | for i in range(N):
16 | x[i] = (b[i] - L[i, :i] @ x[:i]) / L[i, i]
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/trisolv/trisolv_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(L, x, b):
11 | for i in range(x.shape[0]):
12 | x[i] = (b[i] - L[i, :i] @ x[:i]) / L[i, i]
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/trisolv/trisolv_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(L, x, b):
13 | for i in range(x.shape[0]):
14 | x[i] = (b[i] - L[i, :i] @ x[:i]) / L[i, i]
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/trisolv/trisolv_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(L, x, b):
13 | for i in range(x.shape[0]):
14 | x[i] = (b[i] - L[i, :i] @ x[:i]) / L[i, i]
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/trisolv/trisolv_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(L, x, b):
13 | for i in range(x.shape[0]):
14 | x[i] = (b[i] - L[i, :i] @ x[:i]) / L[i, i]
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/trisolv/trisolv_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(L, x, b):
11 | for i in range(x.shape[0]):
12 | x[i] = (b[i] - L[i, :i] @ x[:i]) / L[i, i]
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/linear-algebra/solvers/trisolv/trisolv_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(float64[:,:], float64[:], float64[:])
11 | def kernel(L, x, b):
12 | for i in range(x.shape[0]):
13 | x[i] = (b[i] - L[i, :i] @ x[:i]) / L[i, i]
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/deriche/deriche.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(W, H, datatype=np.float64):
10 | alpha = datatype(0.25)
11 | imgIn = np.fromfunction(
12 | lambda i, j: ((313 * i + 991 * j) % 65536) / 65535.0,
13 | (W, H),
14 | dtype=datatype,
15 | )
16 |
17 | return alpha, imgIn
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.int32):
10 | path = np.fromfunction(lambda i, j: i * j % 7 + 1, (N, N), dtype=datatype)
11 | for i in range(N):
12 | for j in range(N):
13 | if (i + j) % 13 == 0 or (i + j) % 7 == 0 or (i + j) % 11 == 0:
14 | path[i, j] = 999
15 |
16 | return path
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(path):
11 | for k in range(path.shape[0]):
12 | # path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
13 | for i in range(path.shape[0]):
14 | path[i, :] = np.minimum(path[i, :], path[i, k] + path[k, :])
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | N = dc.symbol("N", dtype=dc.int64)
11 |
12 |
13 | @dc.program
14 | def kernel(path: dc.int32[N, N]):
15 | # def kernel(path: dc.float64[N, N]):
16 |
17 | for k in range(N):
18 | path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
19 | # for i in range(N):
20 | # path[i, :] = np.minimum(path[i, :], path[i, k] + path[k, :])
21 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(path):
11 | for k in range(path.shape[0]):
12 | path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_numba_dpex_p.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | import numba as nb
9 | from numba_dpex import dpjit
10 |
11 |
12 | @dpjit
13 | def kernel(path):
14 | for k in range(path.shape[0]):
15 | # path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
16 | for i in nb.prange(path.shape[0]):
17 | path[i, :] = np.minimum(path[i, :], path[i, k] + path[k, :])
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(path):
13 | for k in range(path.shape[0]):
14 | # path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
15 | for i in range(path.shape[0]):
16 | path[i, :] = np.minimum(path[i, :], path[i, k] + path[k, :])
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(path):
13 | for k in range(path.shape[0]):
14 | # path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
15 | for i in range(path.shape[0]):
16 | path[i, :] = np.minimum(path[i, :], path[i, k] + path[k, :])
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_numba_npr.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(path):
13 | for k in range(path.shape[0]):
14 | # path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
15 | for i in nb.prange(path.shape[0]):
16 | path[i, :] = np.minimum(path[i, :], path[i, k] + path[k, :])
17 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_numba_o.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=False, forceobj=True, parallel=False, fastmath=True)
12 | def kernel(path):
13 | for k in range(path.shape[0]):
14 | path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_numba_op.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=False, forceobj=True, parallel=True, fastmath=True)
12 | def kernel(path):
13 | for k in range(path.shape[0]):
14 | path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(path):
11 | for k in range(path.shape[0]):
12 | path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/floyd_warshall/floyd_warshall_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(int32[:,:])
11 | def kernel(path):
12 | for k in range(path.shape[0]):
13 | # path[:] = np.minimum(path[:], np.add.outer(path[:, k], path[k, :]))
14 | for i in range(path.shape[0]):
15 | path[i, :] = np.minimum(path[i, :], path[i, k] + path[k, :])
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/medley/nussinov/nussinov.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.int32):
10 | seq = np.fromfunction(lambda i: (i + 1) % 4, (N,), dtype=datatype)
11 |
12 | return seq
13 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/adi/adi.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def initialize(N, datatype=np.float64):
11 | u = np.fromfunction(lambda i, j: (i + N - j) / N, (N, N), dtype=datatype)
12 |
13 | return u
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/fdtd_2d/fdtd_2d.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(TMAX, NX, NY, datatype=np.float64):
10 | ex = np.fromfunction(
11 | lambda i, j: (i * (j + 1)) / NX, (NX, NY), dtype=datatype
12 | )
13 | ey = np.fromfunction(
14 | lambda i, j: (i * (j + 2)) / NY, (NX, NY), dtype=datatype
15 | )
16 | hz = np.fromfunction(
17 | lambda i, j: (i * (j + 3)) / NX, (NX, NY), dtype=datatype
18 | )
19 | _fict_ = np.fromfunction(lambda i: i, (TMAX,), dtype=datatype)
20 |
21 | return ex, ey, hz, _fict_
22 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/fdtd_2d/fdtd_2d_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import cupy as np
8 |
9 |
10 | def kernel(TMAX, ex, ey, hz, _fict_):
11 | for t in range(TMAX):
12 | ey[0, :] = _fict_[t]
13 | ey[1:, :] -= 0.5 * (hz[1:, :] - hz[:-1, :])
14 | ex[:, 1:] -= 0.5 * (hz[:, 1:] - hz[:, :-1])
15 | hz[:-1, :-1] -= 0.7 * (
16 | ex[:-1, 1:] - ex[:-1, :-1] + ey[1:, :-1] - ey[:-1, :-1]
17 | )
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/fdtd_2d/fdtd_2d_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(TMAX, ex, ey, hz, _fict_):
11 | for t in range(TMAX):
12 | ey[0, :] = _fict_[t]
13 | ey[1:, :] -= 0.5 * (hz[1:, :] - hz[:-1, :])
14 | ex[:, 1:] -= 0.5 * (hz[:, 1:] - hz[:, :-1])
15 | hz[:-1, :-1] -= 0.7 * (
16 | ex[:-1, 1:] - ex[:-1, :-1] + ey[1:, :-1] - ey[:-1, :-1]
17 | )
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/fdtd_2d/fdtd_2d_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(TMAX, ex, ey, hz, _fict_):
13 | for t in range(TMAX):
14 | ey[0, :] = _fict_[t]
15 | ey[1:, :] -= 0.5 * (hz[1:, :] - hz[:-1, :])
16 | ex[:, 1:] -= 0.5 * (hz[:, 1:] - hz[:, :-1])
17 | hz[:-1, :-1] -= 0.7 * (
18 | ex[:-1, 1:] - ex[:-1, :-1] + ey[1:, :-1] - ey[:-1, :-1]
19 | )
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/fdtd_2d/fdtd_2d_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(TMAX, ex, ey, hz, _fict_):
13 | for t in range(TMAX):
14 | ey[0, :] = _fict_[t]
15 | ey[1:, :] -= 0.5 * (hz[1:, :] - hz[:-1, :])
16 | ex[:, 1:] -= 0.5 * (hz[:, 1:] - hz[:, :-1])
17 | hz[:-1, :-1] -= 0.7 * (
18 | ex[:-1, 1:] - ex[:-1, :-1] + ey[1:, :-1] - ey[:-1, :-1]
19 | )
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/fdtd_2d/fdtd_2d_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(TMAX, ex, ey, hz, _fict_):
13 | for t in range(TMAX):
14 | ey[0, :] = _fict_[t]
15 | ey[1:, :] -= 0.5 * (hz[1:, :] - hz[:-1, :])
16 | ex[:, 1:] -= 0.5 * (hz[:, 1:] - hz[:, :-1])
17 | hz[:-1, :-1] -= 0.7 * (
18 | ex[:-1, 1:] - ex[:-1, :-1] + ey[1:, :-1] - ey[:-1, :-1]
19 | )
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/fdtd_2d/fdtd_2d_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(TMAX, ex, ey, hz, _fict_):
11 | for t in range(TMAX):
12 | ey[0, :] = _fict_[t]
13 | ey[1:, :] -= 0.5 * (hz[1:, :] - hz[:-1, :])
14 | ex[:, 1:] -= 0.5 * (hz[:, 1:] - hz[:, :-1])
15 | hz[:-1, :-1] -= 0.7 * (
16 | ex[:-1, 1:] - ex[:-1, :-1] + ey[1:, :-1] - ey[:-1, :-1]
17 | )
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/fdtd_2d/fdtd_2d_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(int, float64[:,:], float64[:,:], float64[:,:], float64[:])
11 | def kernel(TMAX, ex, ey, hz, _fict_):
12 | for t in range(TMAX):
13 | ey[0, :] = _fict_[t]
14 | ey[1:, :] -= 0.5 * (hz[1:, :] - hz[:-1, :])
15 | ex[:, 1:] -= 0.5 * (hz[:, 1:] - hz[:, :-1])
16 | hz[:-1, :-1] -= 0.7 * (
17 | ex[:-1, 1:] - ex[:-1, :-1] + ey[1:, :-1] - ey[:-1, :-1]
18 | )
19 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/heat_3d/heat_3d.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | A = np.fromfunction(
11 | lambda i, j, k: (i + j + (N - k)) * 10 / N, (N, N, N), dtype=datatype
12 | )
13 | B = np.copy(A)
14 |
15 | return A, B
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/jacobi_1d/jacobi_1d.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | A = np.fromfunction(lambda i: (i + 2) / N, (N,), dtype=datatype)
11 | B = np.fromfunction(lambda i: (i + 3) / N, (N,), dtype=datatype)
12 |
13 | return A, B
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/jacobi_1d/jacobi_1d_cupy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(TSTEPS, A, B):
11 | for t in range(1, TSTEPS):
12 | B[1:-1] = 0.33333 * (A[:-2] + A[1:-1] + A[2:])
13 | A[1:-1] = 0.33333 * (B[:-2] + B[1:-1] + B[2:])
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/jacobi_1d/jacobi_1d_dace.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dace as dc
8 | import numpy as np
9 |
10 | N = dc.symbol("N", dtype=dc.int64)
11 |
12 |
13 | @dc.program
14 | def kernel(TSTEPS: dc.int64, A: dc.float64[N], B: dc.float64[N]):
15 | for t in range(1, TSTEPS):
16 | B[1:-1] = 0.33333 * (A[:-2] + A[1:-1] + A[2:])
17 | A[1:-1] = 0.33333 * (B[:-2] + B[1:-1] + B[2:])
18 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/jacobi_1d/jacobi_1d_dpnp.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 |
9 |
10 | def kernel(TSTEPS, A, B):
11 | for t in range(1, TSTEPS):
12 | B[1:-1] = 0.33333 * (A[:-2] + A[1:-1] + A[2:])
13 | A[1:-1] = 0.33333 * (B[:-2] + B[1:-1] + B[2:])
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/jacobi_1d/jacobi_1d_numba_dpex_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import dpnp as np
8 | from numba_dpex import dpjit
9 |
10 |
11 | @dpjit
12 | def kernel(TSTEPS, A, B):
13 | for t in range(1, TSTEPS):
14 | B[1:-1] = 0.33333 * (A[:-2] + A[1:-1] + A[2:])
15 | A[1:-1] = 0.33333 * (B[:-2] + B[1:-1] + B[2:])
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/jacobi_1d/jacobi_1d_numba_n.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=False, fastmath=True)
12 | def kernel(TSTEPS, A, B):
13 | for t in range(1, TSTEPS):
14 | B[1:-1] = 0.33333 * (A[:-2] + A[1:-1] + A[2:])
15 | A[1:-1] = 0.33333 * (B[:-2] + B[1:-1] + B[2:])
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/jacobi_1d/jacobi_1d_numba_np.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numba as nb
8 | import numpy as np
9 |
10 |
11 | @nb.jit(nopython=True, parallel=True, fastmath=True)
12 | def kernel(TSTEPS, A, B):
13 | for t in range(1, TSTEPS):
14 | B[1:-1] = 0.33333 * (A[:-2] + A[1:-1] + A[2:])
15 | A[1:-1] = 0.33333 * (B[:-2] + B[1:-1] + B[2:])
16 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/jacobi_1d/jacobi_1d_numpy.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | def kernel(TSTEPS, A, B):
11 | for t in range(1, TSTEPS):
12 | B[1:-1] = 0.33333 * (A[:-2] + A[1:-1] + A[2:])
13 | A[1:-1] = 0.33333 * (B[:-2] + B[1:-1] + B[2:])
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/jacobi_1d/jacobi_1d_pythran.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2010-2016 Ohio State University
2 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
3 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
4 | #
5 | # SPDX-License-Identifier: BSD-3-Clause
6 |
7 | import numpy as np
8 |
9 |
10 | # pythran export kernel(int, float64[:], float64[:])
11 | def kernel(TSTEPS, A, B):
12 | for t in range(1, TSTEPS):
13 | B[1:-1] = 0.33333 * (A[:-2] + A[1:-1] + A[2:])
14 | A[1:-1] = 0.33333 * (B[:-2] + B[1:-1] + B[2:])
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/jacobi_2d/jacobi_2d.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | A = np.fromfunction(lambda i, j: i * (j + 2) / N, (N, N), dtype=datatype)
11 | B = np.fromfunction(lambda i, j: i * (j + 3) / N, (N, N), dtype=datatype)
12 |
13 | return A, B
14 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/polybench/stencils/seidel_2d/seidel_2d.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2021 ETH Zurich and the NPBench authors
2 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
3 | #
4 | # SPDX-License-Identifier: BSD-3-Clause
5 |
6 | import numpy as np
7 |
8 |
9 | def initialize(N, datatype=np.float64):
10 | A = np.fromfunction(
11 | lambda i, j: (i * (j + 2) + 2) / N, (N, N), dtype=datatype
12 | )
13 |
14 | return A
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/rodinia/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(gaussian)
6 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/rodinia/gaussian/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | add_subdirectory(gaussian_sycl_native_ext)
6 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/rodinia/gaussian/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """Gaussian elimination implementation."""
6 |
7 | """This is sycl and numba-dpex implementation for gaussian elimination
8 | Input
9 | ---------
10 | size : Forms an input matrix of dimensions (size x size)
11 | Output
12 | --------
13 | result> : Result of the given set of linear equations using
14 | gaussian elimination.
15 | Method:
16 | The gaussian transformations are applied to the input matrix to form the
17 | diagonal matrix in forward elimination, and then the equations are solved
18 | to find the result in back substitution.
19 | """
20 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/rodinia/gaussian/gaussian_sycl_native_ext/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | set(module_name gaussian_sycl)
6 | set(py_module_name _${module_name})
7 | python_add_library(${py_module_name} MODULE ${module_name}/${py_module_name}.cpp)
8 | add_sycl_to_target(TARGET ${py_module_name} SOURCES ${module_name}/${py_module_name}.cpp)
9 | target_include_directories(${py_module_name} PRIVATE ${Dpctl_INCLUDE_DIRS})
10 |
11 | file(RELATIVE_PATH py_module_dest ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
12 | install(TARGETS ${py_module_name}
13 | DESTINATION ${py_module_dest}/${module_name}
14 | )
15 |
--------------------------------------------------------------------------------
/dpbench/benchmarks/rodinia/gaussian/gaussian_sycl_native_ext/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 | """Sycl implementation for gaussian elimination."""
5 |
6 | from .gaussian_sycl._gaussian_sycl import gaussian as gaussian_sycl
7 |
8 | __all__ = ["gaussian_sycl"]
9 |
--------------------------------------------------------------------------------
/dpbench/config/implementation_postfix.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """Implementation related configuration classes."""
6 |
7 | from dataclasses import dataclass
8 | from typing import Any
9 |
10 |
11 | @dataclass
12 | class Implementation:
13 | """Configuration with implementation information."""
14 |
15 | postfix: str
16 | description: str
17 |
18 | @staticmethod
19 | def from_dict(obj: Any) -> "Implementation":
20 | """Convert object into Implementation dataclass."""
21 | _impl_postfix = str(obj.get("impl_postfix"))
22 | _description = str(obj.get("description"))
23 | return Implementation(_impl_postfix, _description)
24 |
--------------------------------------------------------------------------------
/dpbench/config/module.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """Module related configuration classes."""
6 |
7 | from dataclasses import dataclass
8 |
9 |
10 | @dataclass
11 | class Module:
12 | """Benchmark set configuration."""
13 |
14 | benchmark_configs_path: str = ""
15 | benchmark_configs_recursive: bool = False
16 | framework_configs_path: str = ""
17 | precision_dtypes_path: str = ""
18 |
19 | benchmarks_module: str = ""
20 | path: str = ""
21 |
--------------------------------------------------------------------------------
/dpbench/configs/framework_info/cupy.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | [framework]
6 | simple_name = "cupy"
7 | full_name = "cupy"
8 | prefix = "cp"
9 | postfix = "cupy"
10 | class = "CupyFramework"
11 | arch = "gpu"
12 |
13 | [[framework.postfixes]]
14 | impl_postfix = "cupy"
15 | description = "cupy"
16 |
--------------------------------------------------------------------------------
/dpbench/configs/framework_info/dpcpp.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | [framework]
6 | simple_name = "dpcpp"
7 | full_name = "dpcpp"
8 | prefix = "dp"
9 | postfix = "dpcpp"
10 | class = "DpcppFramework"
11 | arch = "cpu"
12 | sycl_device = "cpu"
13 | dpcpp_version = "IntelLLVM 2024.2.1"
14 |
15 | [[framework.postfixes]]
16 | impl_postfix = "sycl"
17 | description = "DPC++ native ext."
18 |
--------------------------------------------------------------------------------
/dpbench/configs/framework_info/dpnp.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | [framework]
6 | simple_name = "dpnp"
7 | full_name = "dpnp"
8 | prefix = "dp"
9 | postfix = "dpnp"
10 | class = "DpnpFramework"
11 | arch = "cpu"
12 | sycl_device = "cpu"
13 |
14 | [[framework.postfixes]]
15 | impl_postfix = "dpnp"
16 | description = "dpnp"
17 |
--------------------------------------------------------------------------------
/dpbench/configs/framework_info/numba.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | [framework]
6 | simple_name = "numba"
7 | full_name = "Numba"
8 | prefix = "nb"
9 | class = "NumbaFramework"
10 | arch = "cpu"
11 |
12 | [[framework.postfixes]]
13 | impl_postfix = "numba_n"
14 | description = "Numba nopython"
15 |
16 | [[framework.postfixes]]
17 | impl_postfix = "numba_np"
18 | description = "Numba nopython, Parallel=True"
19 |
20 | [[framework.postfixes]]
21 | impl_postfix = "numba_npr"
22 | description = "Numba nopython, Parallel=True, prange"
23 |
--------------------------------------------------------------------------------
/dpbench/configs/framework_info/numba_cuda.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | [framework]
6 | simple_name = "numba_cuda"
7 | full_name = "Numba for CUDA GPUs"
8 | prefix = "nbcd"
9 | class = "NumbaCudaFramework"
10 | arch = "gpu"
11 |
12 | [[framework.postfixes]]
13 | impl_postfix = "numba_cuda"
14 | description = "numba cuda jit"
15 |
--------------------------------------------------------------------------------
/dpbench/configs/framework_info/numba_dpex.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | [framework]
6 | simple_name = "numba_dpex"
7 | full_name = "numba_dpex"
8 | prefix = "dpex"
9 | class = "NumbaDpexFramework"
10 | arch = "cpu"
11 | sycl_device = "cpu"
12 |
13 | [[framework.postfixes]]
14 | impl_postfix = "numba_dpex_k"
15 | description = "Numba-dpex kernel"
16 |
17 | [[framework.postfixes]]
18 | impl_postfix = "numba_dpex_p"
19 | description = "Numba-dpex prange"
20 |
21 | [[framework.postfixes]]
22 | impl_postfix = "numba_dpex_n"
23 | description = "Numba-dpex NumPy API"
24 |
--------------------------------------------------------------------------------
/dpbench/configs/framework_info/numba_mlir.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | [framework]
6 | simple_name = "numba_mlir"
7 | full_name = "numba_mlir"
8 | prefix = "mlir"
9 | class = "NumbaMlirFramework"
10 | sycl_device = "opencl:cpu:0"
11 |
12 | [[framework.postfixes]]
13 | impl_postfix = "numba_mlir_k"
14 | description = "Numba-mlir kernel"
15 |
16 | [[framework.postfixes]]
17 | impl_postfix = "numba_mlir_p"
18 | description = "Numba-mlir prange"
19 |
20 | [[framework.postfixes]]
21 | impl_postfix = "numba_mlir_n"
22 | description = "Numba-mlir NumPy API"
23 |
--------------------------------------------------------------------------------
/dpbench/configs/framework_info/numpy.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | [framework]
6 | simple_name = "numpy"
7 | full_name = "NumPy"
8 | prefix = "np"
9 | postfix = "numpy"
10 | class = "Framework"
11 | arch = "cpu"
12 |
13 | [[framework.postfixes]]
14 | impl_postfix = "numpy"
15 | description = "NumPy"
16 |
--------------------------------------------------------------------------------
/dpbench/configs/framework_info/python.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | [framework]
6 | simple_name = "python"
7 | full_name = "Python"
8 | prefix = "python"
9 | postfix = "python"
10 | class = "Framework"
11 | arch = "cpu"
12 |
13 | [[framework.postfixes]]
14 | impl_postfix = "python"
15 | description = "Python"
16 |
--------------------------------------------------------------------------------
/dpbench/configs/precision_dtypes.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | [int]
6 | single = "i4"
7 | double = "i8"
8 |
9 | [float]
10 | single = "f4"
11 | double = "f8"
12 |
--------------------------------------------------------------------------------
/dpbench/console/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | """Console tools."""
6 |
--------------------------------------------------------------------------------
/dpbench/migrations/README:
--------------------------------------------------------------------------------
1 | Generic single-database configuration.
2 |
--------------------------------------------------------------------------------
/dpbench/migrations/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/dpbench/migrations/script.py.mako:
--------------------------------------------------------------------------------
1 | """${message}
2 |
3 | Revision ID: ${up_revision}
4 | Revises: ${down_revision | comma,n}
5 | Create Date: ${create_date}
6 |
7 | """
8 | from alembic import op
9 | import sqlalchemy as sa
10 | ${imports if imports else ""}
11 |
12 | # revision identifiers, used by Alembic.
13 | revision = ${repr(up_revision)}
14 | down_revision = ${repr(down_revision)}
15 | branch_labels = ${repr(branch_labels)}
16 | depends_on = ${repr(depends_on)}
17 |
18 |
19 | def upgrade() -> None:
20 | ${upgrades if upgrades else "pass"}
21 |
22 |
23 | def downgrade() -> None:
24 | ${downgrades if downgrades else "pass"}
25 |
--------------------------------------------------------------------------------
/dpbench/migrations/versions/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/environments/conda.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | name: dpbench-dev
6 | channels:
7 | - dppy/label/dev
8 | - https://software.repos.intel.com/python/conda
9 | - conda-forge
10 | - nodefaults
11 | dependencies:
12 | - pip
13 | - tomli
14 | - alembic
15 | - sqlalchemy
16 | - py-cpuinfo
17 | - scipy
18 | - scikit-learn
19 | - versioneer
20 | - pandas
21 | - intel-opencl-rt # need for set-intel-ocl-icd-registry.ps1
22 | - numpy
23 | - numba
24 | - dpctl
25 | - dpnp
26 | - numba-dpex>=0.23.0*
27 |
--------------------------------------------------------------------------------