├── docs ├── .gitmodules ├── source │ ├── _static │ │ └── .keep │ ├── requirements.txt │ └── index.rst ├── API │ ├── bc_s.png │ ├── bdwn.png │ ├── doc.png │ ├── open.png │ ├── closed.png │ ├── nav_f.png │ ├── nav_g.png │ ├── nav_h.png │ ├── tab_a.png │ ├── tab_b.png │ ├── tab_h.png │ ├── tab_s.png │ ├── doxygen.png │ ├── splitbar.png │ ├── sync_off.png │ ├── sync_on.png │ ├── folderopen.png │ ├── folderclosed.png │ ├── search │ │ ├── close.png │ │ ├── mag_sel.png │ │ ├── search_l.png │ │ ├── search_m.png │ │ ├── search_r.png │ │ ├── pages_0.js │ │ ├── pages_2.js │ │ ├── pages_1.js │ │ ├── enumvalues_1.js │ │ ├── variables_0.js │ │ ├── enumvalues_4.js │ │ ├── enumvalues_7.js │ │ ├── all_a.js │ │ ├── enumvalues_5.js │ │ ├── classes_0.js │ │ ├── typedefs_0.js │ │ ├── all_5.js │ │ ├── pages_3.js │ │ ├── all_8.js │ │ ├── variables_3.js │ │ ├── all_4.js │ │ ├── enumvalues_3.js │ │ ├── groups_1.js │ │ ├── variables_5.js │ │ ├── variables_1.js │ │ ├── all_b.js │ │ ├── enumvalues_6.js │ │ ├── defines_0.js │ │ ├── nomatches.html │ │ ├── all_c.js │ │ ├── all_9.js │ │ ├── all_6.js │ │ ├── variables_4.js │ │ ├── all_2.js │ │ ├── all_0.js │ │ ├── groups_0.js │ │ ├── variables_2.js │ │ ├── enumvalues_0.js │ │ ├── enums_0.js │ │ ├── searchdata.js │ │ ├── enumvalues_2.js │ │ └── all_7.js │ ├── bml__convert_8h.js │ ├── files_dup.js │ ├── bml__export_8h.js │ ├── bml__import_8h.js │ ├── bml__element__multiply_8h.js │ ├── bml__adjungate__triangle_8h.js │ ├── bml__transpose__triangle_8h.js │ ├── dir_68267d1309a1af8e8297ef4c3efbcdba.js │ ├── bml__init_8h.js │ ├── bml__trace_8h.js │ ├── annotated_dup.js │ ├── bml__shutdown_8h.js │ ├── bml__threshold_8h.js │ ├── bml__transpose_8h.js │ ├── group__convert__group__C.js │ ├── bml__scale_8h.js │ ├── bml__getters_8h.js │ ├── bml__setters_8h.js │ ├── bml__add_8h.js │ ├── bml__multiply_8h.js │ ├── bml__normalize_8h.js │ ├── group__add__group__C.js │ ├── bml__copy_8h.js │ ├── bml__norm_8h.js │ ├── structbml__matrix__dimension__t.js │ ├── modules.js │ ├── bml__utilities_8h.js │ ├── bml__submatrix_8h.js │ └── bml__parallel_8h.js ├── favicon.ico ├── Makefile ├── Gemfile ├── _config.yml └── make.bat ├── .codecov.yml ├── bml-manual.pdf ├── CODEOWNERS ├── scripts ├── run-coverage.sh ├── setenv_iris.sh ├── prepare-container-macos.sh ├── setenv_crusher_offload.sh ├── setenv_spock_offload.sh ├── setenv_spock_magma_gcc.sh ├── setenv_crusher_magma_gcc.sh ├── setenv_crusher_offload_rocm_5.3.sh ├── build_scaling.sh ├── setenv_crusher_cce.sh ├── setenv_crusher_magma_cce.sh ├── setenv_lassen_offload.sh ├── update_tags.sh ├── setenv_tulip.sh ├── run-local-docker-container.sh ├── setenv_tulip_offload.sh ├── install_rocsparse_headers_olcf.sh ├── magma_build.sh ├── pre-commit ├── ci-defaults.sh ├── example_build.sh ├── ci-gcc-4.8-C-double-real.sh ├── ci-gcc-4.8-C-single-real.sh ├── ci-gcc-4.8-C-double-complex.sh ├── ci-gcc-4.8-C-single-complex.sh ├── ci-clang-16-gfortran-10-C-double-real.sh ├── ci-clang-16-gfortran-10-C-single-real.sh ├── ci-clang-16-gfortran-14-C-double-real.sh ├── ci-clang-16-gfortran-14-C-single-real.sh ├── ci-clang-16-gfortran-10-C-double-complex.sh ├── ci-clang-16-gfortran-10-C-single-complex.sh ├── ci-clang-16-gfortran-14-C-double-complex.sh ├── ci-clang-16-gfortran-14-C-single-complex.sh ├── build_crusher_offload_cce.sh ├── ci-gcc-10-C-double-real.sh ├── ci-gcc-10-C-single-real.sh ├── ci-gcc-14-C-double-real.sh ├── ci-gcc-14-C-single-real.sh ├── ci-gcc-10-C-double-complex.sh ├── ci-gcc-10-C-single-complex.sh ├── ci-gcc-14-C-double-complex.sh ├── ci-gcc-14-C-single-complex.sh ├── ci-MPI-double-real.sh ├── ci-MPI-single-real.sh ├── ci-MPI-double-complex.sh ├── ci-MPI-single-complex.sh ├── build_spock_offload_cce.sh ├── build_tulip_magma_cce.sh ├── offload_build.sh ├── build_crusher_rocsparse_cce.sh ├── build_crusher_magma_cce.sh ├── build_tulip_offload_cce.sh ├── build_iris_offload_oneapi.sh ├── build_olcf_summit_gnu_mgma_openblas.sh ├── build_spock_magma_gcc.sh ├── build_crusher_magma_gcc.sh └── build_olcf_summit_gnu_offload_openblas.sh ├── tests ├── CMakeLists.txt ├── Fortran-tests │ ├── precision.F90 │ ├── prec.F90 │ └── example_template_typed.F90 └── C-tests │ ├── test_backtrace.c │ ├── test_openmp_offload.c │ ├── test_template_typed.c │ ├── add_matrix.h │ ├── copy_matrix.h │ ├── norm_matrix.h │ ├── print_matrix.h │ ├── scale_matrix.h │ ├── trace_matrix.h │ ├── set_row.h │ ├── bml_gemm.h │ ├── adjacency_matrix.h │ ├── convert_matrix.h │ ├── inverse_matrix.h │ ├── test_template.h │ ├── allocate_matrix.h │ ├── io_matrix.h │ ├── multiply_matrix.h │ ├── get_element.h │ ├── set_element.h │ ├── trace_mult.h │ ├── normalize_matrix.h │ ├── submatrix_matrix.h │ ├── threshold_matrix.h │ ├── transpose_matrix.h │ ├── introspection.h │ ├── diagonalize_matrix.h │ ├── get_sparsity.h │ ├── mpi_sendrecv.h │ ├── multiply_matrix_x2.h │ ├── import_export_matrix.h │ ├── get_set_diagonal.h │ ├── multiply_banded_matrix.h │ ├── element_multiply_matrix.h │ ├── adjungate_triangle_matrix.h │ └── add_matrix.c ├── .gitignore ├── documentation └── references.bib ├── src ├── C-interface │ ├── bml_types_private.h │ ├── bml_inverse.h │ ├── bml_shutdown.h │ ├── bml_export.h │ ├── bml_diagonalize.h │ ├── bml_adjungate_triangle.h │ ├── bml_transpose_triangle.h │ ├── ellpack │ │ ├── bml_adjacency_ellpack.h │ │ ├── bml_adjacency_ellpack.c │ │ ├── bml_inverse_ellpack.h │ │ ├── bml_elemental_ellpack.h │ │ ├── bml_export_ellpack.h │ │ ├── bml_adjungate_triangle_ellpack.h │ │ ├── bml_diagonalize_ellpack.h │ │ ├── bml_convert_ellpack_typed.c │ │ ├── bml_inverse_ellpack.c │ │ └── bml_element_multiply_ellpack.h │ ├── bml_transpose.h │ ├── bml_threshold.h │ ├── bml_init.h │ ├── bml_trace.h │ ├── bml_convert.h │ ├── bml_element_multiply.h │ ├── bml_getters.h │ ├── distributed2d │ │ ├── bml_convert_distributed2d.h │ │ ├── bml_transpose_distributed2d.h │ │ ├── bml_trace_distributed2d.h │ │ ├── bml_utilities_distributed2d.h │ │ ├── bml_getters_distributed2d.h │ │ ├── bml_introspection_distributed2d.h │ │ ├── bml_add_distributed2d.h │ │ ├── bml_export_distributed2d.h │ │ ├── bml_getters_distributed2d.c │ │ ├── bml_norm_distributed2d.h │ │ ├── bml_threshold_distributed2d.h │ │ ├── bml_convert_distributed2d.c │ │ └── bml_threshold_distributed2d.c │ ├── bml_import.h │ ├── bml_scale.h │ ├── bml_copy.h │ ├── csr │ │ ├── bml_inverse_csr.h │ │ ├── bml_export_csr.h │ │ ├── bml_diagonalize_csr.h │ │ ├── bml_element_multiply_csr.h │ │ ├── bml_inverse_csr.c │ │ ├── bml_convert_csr.h │ │ └── bml_trace_csr.h │ ├── bml_normalize.h │ ├── bml_setters.h │ ├── bml_elemental.h │ ├── ellblock │ │ ├── bml_inverse_ellblock.h │ │ ├── bml_export_ellblock.h │ │ ├── bml_diagonalize_ellblock.h │ │ └── bml_inverse_ellblock.c │ ├── bml_add.h │ ├── dense │ │ ├── bml_elemental_dense.h │ │ ├── bml_transpose_triangle_dense.h │ │ ├── bml_adjungate_triangle_dense.h │ │ ├── bml_export_dense.h │ │ ├── bml_diagonalize_dense.h │ │ ├── bml_element_multiply_dense.h │ │ ├── bml_inverse_dense.h │ │ ├── bml_transpose_dense.h │ │ ├── bml_convert_dense.h │ │ └── bml_trace_dense.h │ ├── bml_multiply.h │ ├── bml_shutdown.c │ ├── bml_introspection.h │ ├── bml_inverse.c │ ├── bml_transpose_triangle.c │ ├── bml_init.c │ ├── bml_utilities.h │ └── bml_norm.h ├── Fortran-interface │ ├── bml_typed_m.F90 │ ├── bml_logger_m.F90 │ ├── bml_threshold_m.F90 │ ├── bml_shutdown_m.F90 │ ├── bml_print_matrix_wrapper.c │ ├── bml_inverse_m.F90 │ ├── bml_init_m.F90 │ ├── bml_adjungate_triangle_m.F90 │ ├── bml_transpose_triangle_m.F90 │ ├── bml.F90 │ ├── bml_transpose_m.F90 │ ├── bml_diagonalize_m.F90 │ ├── bml_parallel_m.F90 │ ├── bml_trace_m.F90 │ └── bml_fc_tools_m.F90 ├── bml_version.c ├── bml.pc.in ├── BMLConfig.cmakein └── internal-blas │ └── CMakeLists.txt ├── Dockerfile-impish ├── Dockerfile-hirsute ├── Dockerfile-bionic ├── Gemfile ├── cmake ├── test_complex.c ├── bmlAddTypedLibrary.cmake ├── FindELPA.cmake └── bmlCheckCFortranFunctionExists.cmake ├── .readthedocs.yaml ├── .dir-locals.el ├── .devcontainer └── devcontainer.json ├── examples ├── example4 │ └── Makefile ├── example2 │ └── Makefile ├── example3 │ └── Makefile └── example1 │ └── Makefile ├── Dangerfile ├── .github ├── workflows │ ├── trigger-qmd.yaml │ └── stale.yaml └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── test-getter ├── ptr.F90 └── ptr.c ├── Dockerfile-noble ├── Dockerfile-focal └── Dockerfile-jammy /docs/.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/_static/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 0 3 | round: down 4 | -------------------------------------------------------------------------------- /bml-manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/bml-manual.pdf -------------------------------------------------------------------------------- /docs/API/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/bc_s.png -------------------------------------------------------------------------------- /docs/API/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/bdwn.png -------------------------------------------------------------------------------- /docs/API/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/doc.png -------------------------------------------------------------------------------- /docs/API/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/open.png -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/favicon.ico -------------------------------------------------------------------------------- /docs/source/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx==7.2.6 2 | sphinx_rtd_theme==2.0.0 3 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @nicolasbock @cnegre @suemni @jeanlucf22 @tokshgithub @jmohdyusof 2 | -------------------------------------------------------------------------------- /docs/API/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/closed.png -------------------------------------------------------------------------------- /docs/API/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/nav_f.png -------------------------------------------------------------------------------- /docs/API/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/nav_g.png -------------------------------------------------------------------------------- /docs/API/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/nav_h.png -------------------------------------------------------------------------------- /docs/API/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/tab_a.png -------------------------------------------------------------------------------- /docs/API/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/tab_b.png -------------------------------------------------------------------------------- /docs/API/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/tab_h.png -------------------------------------------------------------------------------- /docs/API/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/tab_s.png -------------------------------------------------------------------------------- /docs/API/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/doxygen.png -------------------------------------------------------------------------------- /docs/API/splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/splitbar.png -------------------------------------------------------------------------------- /docs/API/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/sync_off.png -------------------------------------------------------------------------------- /docs/API/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/sync_on.png -------------------------------------------------------------------------------- /scripts/run-coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gcov -a -b -c $(find . -name '*.gcda') 4 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(C-tests) 2 | add_subdirectory(Fortran-tests) 3 | -------------------------------------------------------------------------------- /docs/API/folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/folderopen.png -------------------------------------------------------------------------------- /docs/API/folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/folderclosed.png -------------------------------------------------------------------------------- /docs/API/search/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/search/close.png -------------------------------------------------------------------------------- /docs/API/search/mag_sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/search/mag_sel.png -------------------------------------------------------------------------------- /docs/API/search/search_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/search/search_l.png -------------------------------------------------------------------------------- /docs/API/search/search_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/search/search_m.png -------------------------------------------------------------------------------- /docs/API/search/search_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/bml/HEAD/docs/API/search/search_r.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | /build 3 | /build.log 4 | **/*.indented 5 | /install 6 | /tags 7 | /TAGS 8 | /.vscode 9 | /worktrees 10 | -------------------------------------------------------------------------------- /scripts/setenv_iris.sh: -------------------------------------------------------------------------------- 1 | module use /soft/restricted/CNDA/modulefiles 2 | module load oneapi 3 | module swap cmake cmake/3.19.3 4 | -------------------------------------------------------------------------------- /documentation/references.bib: -------------------------------------------------------------------------------- 1 | % References used in the documentation. 2 | 3 | @article{ellpack, 4 | title = {{ELLPACK Data Format}} 5 | } -------------------------------------------------------------------------------- /scripts/prepare-container-macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | SUDO=$(which sudo || true) 6 | 7 | brew install coreutils 8 | -------------------------------------------------------------------------------- /src/C-interface/bml_types_private.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_TYPES_PRIVATE_H 4 | #define __BML_TYPES_PRIVATE_H 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /docs/API/bml__convert_8h.js: -------------------------------------------------------------------------------- 1 | var bml__convert_8h = 2 | [ 3 | [ "bml_convert", "bml__convert_8h.html#a40948cc6a6323f28979710ce223f7d5d", null ] 4 | ]; -------------------------------------------------------------------------------- /docs/API/files_dup.js: -------------------------------------------------------------------------------- 1 | var files_dup = 2 | [ 3 | [ "src", "dir_68267d1309a1af8e8297ef4c3efbcdba.html", "dir_68267d1309a1af8e8297ef4c3efbcdba" ] 4 | ]; -------------------------------------------------------------------------------- /docs/API/bml__export_8h.js: -------------------------------------------------------------------------------- 1 | var bml__export_8h = 2 | [ 3 | [ "bml_export_to_dense", "group__convert__group__C.html#ga287f7c9a50a4541ba28dadad4b3d432e", null ] 4 | ]; -------------------------------------------------------------------------------- /docs/API/search/pages_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['basic_20matrix_20library_20_28bml_29_355',['Basic Matrix Library (bml)',['../index.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/API/search/pages_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['developer_20documentation_358',['Developer Documentation',['../developer_documentation.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /scripts/setenv_crusher_offload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | module load craype-accel-amd-gfx90a 4 | module load rocm/5.1.0 5 | module load cmake 6 | module load openblas 7 | -------------------------------------------------------------------------------- /scripts/setenv_spock_offload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | module load craype-accel-amd-gfx908 4 | module load rocm 5 | module load cmake 6 | module load openblas 7 | 8 | -------------------------------------------------------------------------------- /docs/API/bml__import_8h.js: -------------------------------------------------------------------------------- 1 | var bml__import_8h = 2 | [ 3 | [ "bml_import_from_dense", "group__convert__group__C.html#ga75fc0df803de9a52a93feaf91c0471eb", null ] 4 | ]; -------------------------------------------------------------------------------- /scripts/setenv_spock_magma_gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | module load PrgEnv-gnu 4 | module load magma 5 | module load cmake 6 | module load openblas 7 | module load rocm 8 | -------------------------------------------------------------------------------- /scripts/setenv_crusher_magma_gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | module load PrgEnv-gnu 4 | module load magma 5 | module load cmake 6 | module load openblas 7 | module load rocm 8 | 9 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_typed_m.F90: -------------------------------------------------------------------------------- 1 | module bml_typed_m 2 | integer, parameter :: sp = kind(0.0) 3 | integer, parameter :: dp = kind(0.0d0) 4 | end module bml_typed_m 5 | -------------------------------------------------------------------------------- /src/bml_version.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "bml.h" 4 | 5 | int 6 | main( 7 | void) 8 | { 9 | printf("BML Version %s\n", bml_version()); 10 | } 11 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | webpage: 2 | bundle exec jekyll build 3 | 4 | rtd: 5 | sphinx-build source build 6 | 7 | update: 8 | bundle update 9 | 10 | install: 11 | bundle install 12 | -------------------------------------------------------------------------------- /docs/API/bml__element__multiply_8h.js: -------------------------------------------------------------------------------- 1 | var bml__element__multiply_8h = 2 | [ 3 | [ "bml_element_multiply_AB", "bml__element__multiply_8h.html#a60633b0dd40a045e151b08493068a58a", null ] 4 | ]; -------------------------------------------------------------------------------- /docs/API/search/pages_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['c_20usage_356',['C Usage',['../C_usage.html',1,'']]], 4 | ['c_20test_357',['C TEST',['../md__bml_tests_README.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/API/bml__adjungate__triangle_8h.js: -------------------------------------------------------------------------------- 1 | var bml__adjungate__triangle_8h = 2 | [ 3 | [ "bml_adjungate_triangle", "bml__adjungate__triangle_8h.html#a0492e26f185d843e14877c713af985d4", null ] 4 | ]; -------------------------------------------------------------------------------- /docs/API/bml__transpose__triangle_8h.js: -------------------------------------------------------------------------------- 1 | var bml__transpose__triangle_8h = 2 | [ 3 | [ "bml_transpose_triangle", "bml__transpose__triangle_8h.html#a6d869d569c431aed6a4662a2b33458e2", null ] 4 | ]; -------------------------------------------------------------------------------- /docs/API/search/enumvalues_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['csr_329',['csr',['../bml__types_8h.html#ab7d3c21318898af00e7c28712f369842a3f553532794be93f9d14a4ace94a1954',1,'bml_types.h']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/API/search/variables_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['bsizes_300',['bsizes',['../structbml__matrix__dimension__t.html#a9c7bc98a3ba08b6116eb3f88cad158be',1,'bml_matrix_dimension_t']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /scripts/setenv_crusher_offload_rocm_5.3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | module swap cce cce/15.0.0 3 | module load craype-accel-amd-gfx90a 4 | module load rocm/5.3.0 5 | module load cmake 6 | module load openblas 7 | -------------------------------------------------------------------------------- /Dockerfile-impish: -------------------------------------------------------------------------------- 1 | FROM ubuntu:impish 2 | MAINTAINER nicolasbock@gmail.com 3 | 4 | COPY scripts/prepare-container-impish.sh /usr/sbin 5 | RUN /usr/sbin/prepare-container-impish.sh 6 | 7 | WORkDIR /root 8 | -------------------------------------------------------------------------------- /src/C-interface/bml_inverse.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_INVERSE_H 2 | #define __BML_INVERSE_H 3 | 4 | #include "bml_types.h" 5 | 6 | bml_matrix_t *bml_inverse( 7 | bml_matrix_t * A); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /Dockerfile-hirsute: -------------------------------------------------------------------------------- 1 | FROM ubuntu:hirsute 2 | MAINTAINER nicolasbock@gmail.com 3 | 4 | COPY scripts/prepare-container-hirsute.sh /usr/sbin 5 | RUN /usr/sbin/prepare-container-hirsute.sh 6 | 7 | WORkDIR /root 8 | -------------------------------------------------------------------------------- /scripts/build_scaling.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export BLAS_VENDOR=${BLAS_VENDOR:-Intel} 4 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-yes} 5 | export COMMAND=${1:-compile} 6 | 7 | ./build.sh ${COMMAND} 8 | -------------------------------------------------------------------------------- /docs/API/dir_68267d1309a1af8e8297ef4c3efbcdba.js: -------------------------------------------------------------------------------- 1 | var dir_68267d1309a1af8e8297ef4c3efbcdba = 2 | [ 3 | [ "C-interface", "dir_40f4bd1e0d79afce1878e17dca4050b7.html", "dir_40f4bd1e0d79afce1878e17dca4050b7" ] 4 | ]; -------------------------------------------------------------------------------- /scripts/setenv_crusher_cce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | module load cce/15.0.1 3 | module load craype-accel-amd-gfx90a 4 | module load rocm/5.1.0 5 | module load cmake 6 | module load openblas 7 | module load magma/2.6.1 8 | -------------------------------------------------------------------------------- /scripts/setenv_crusher_magma_cce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | module load craype-accel-amd-gfx90a 3 | module load cmake 4 | module load rocm/5.1.0 5 | module load magma/2.6.1 6 | module load cce/15.0.1 7 | module load openblas 8 | -------------------------------------------------------------------------------- /docs/API/bml__init_8h.js: -------------------------------------------------------------------------------- 1 | var bml__init_8h = 2 | [ 3 | [ "bml_init", "bml__init_8h.html#a3bdb2de2d7025decd223d0ac2b0b16a6", null ], 4 | [ "bml_initF", "bml__init_8h.html#a3cd6fc11fc6ae9ba6c756b176a84f6aa", null ] 5 | ]; -------------------------------------------------------------------------------- /docs/API/search/enumvalues_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['graph_5fdistributed_339',['graph_distributed',['../bml__types_8h.html#a4bed60baf88d95c03a021ed4b166a522ab84cdcec3965486fa6e115f45c3e3ce2',1,'bml_types.h']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/API/search/enumvalues_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['type_5funinitialized_344',['type_uninitialized',['../bml__types_8h.html#ab7d3c21318898af00e7c28712f369842ae96fd391f81a83d544ac43e7d59c2ee1',1,'bml_types.h']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /Dockerfile-bionic: -------------------------------------------------------------------------------- 1 | FROM ubuntu:bionic 2 | LABEL org.opencontainers.image.authors="nicolasbock@gmail.com" 3 | 4 | COPY scripts/prepare-container-bionic.sh /usr/sbin 5 | RUN /usr/sbin/prepare-container-bionic.sh 6 | 7 | WORKDIR /root 8 | -------------------------------------------------------------------------------- /docs/API/bml__trace_8h.js: -------------------------------------------------------------------------------- 1 | var bml__trace_8h = 2 | [ 3 | [ "bml_trace", "bml__trace_8h.html#a4ea0d795056795788797fd5fdda3fe92", null ], 4 | [ "bml_trace_mult", "bml__trace_8h.html#a36932c257ba7a958a20f75aa1f40759d", null ] 5 | ]; -------------------------------------------------------------------------------- /docs/API/search/all_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['precision_5funinitialized_173',['precision_uninitialized',['../bml__types_8h.html#a8d762ed64876f48d5eb687cb62f20d5caf4da658d031a1d1fb8303df656517607',1,'bml_types.h']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /scripts/setenv_lassen_offload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #module purge 4 | module load cmake/3.23.1 5 | module load xl/2022.03.10-cuda-11.8.0 6 | module load cuda/11.8.0 7 | module load lapack/3.9.0-xl-2020.11.12 8 | module load essl 9 | -------------------------------------------------------------------------------- /docs/API/search/enumvalues_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['precision_5funinitialized_340',['precision_uninitialized',['../bml__types_8h.html#a8d762ed64876f48d5eb687cb62f20d5caf4da658d031a1d1fb8303df656517607',1,'bml_types.h']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | source "https://rubygems.org" 3 | 4 | gem "danger", "<8" 5 | gem "danger-commit_lint" 6 | gem "danger-mention" 7 | gem "danger-prose" 8 | gem "danger-welcome_message" 9 | gem "faraday", "<1.1.0" 10 | -------------------------------------------------------------------------------- /docs/API/annotated_dup.js: -------------------------------------------------------------------------------- 1 | var annotated_dup = 2 | [ 3 | [ "bml_domain_t", "structbml__domain__t.html", "structbml__domain__t" ], 4 | [ "bml_matrix_dimension_t", "structbml__matrix__dimension__t.html", "structbml__matrix__dimension__t" ] 5 | ]; -------------------------------------------------------------------------------- /docs/API/bml__shutdown_8h.js: -------------------------------------------------------------------------------- 1 | var bml__shutdown_8h = 2 | [ 3 | [ "bml_shutdown", "bml__shutdown_8h.html#ac3465f88ff974726c540c617857140a7", null ], 4 | [ "bml_shutdownF", "bml__shutdown_8h.html#a4313d26eac08e2634c3acea39a9f7120", null ] 5 | ]; -------------------------------------------------------------------------------- /src/C-interface/bml_shutdown.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_SHUTDOWN_H 4 | #define __BML_SHUTDOWN_H 5 | 6 | #include "bml_types.h" 7 | 8 | void bml_shutdown( 9 | ); 10 | 11 | void bml_shutdownF( 12 | ); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /docs/API/bml__threshold_8h.js: -------------------------------------------------------------------------------- 1 | var bml__threshold_8h = 2 | [ 3 | [ "bml_threshold", "bml__threshold_8h.html#a1ba35a8c12b1a8cc5efb5c3dd275b62c", null ], 4 | [ "bml_threshold_new", "bml__threshold_8h.html#a2fe7feac01f0c1247e5de6780732030c", null ] 5 | ]; -------------------------------------------------------------------------------- /docs/API/bml__transpose_8h.js: -------------------------------------------------------------------------------- 1 | var bml__transpose_8h = 2 | [ 3 | [ "bml_transpose", "bml__transpose_8h.html#a6cae9deb71fc1a8a5d8578f547044eff", null ], 4 | [ "bml_transpose_new", "bml__transpose_8h.html#a606ec8404a73e2495a714b8624edf108", null ] 5 | ]; -------------------------------------------------------------------------------- /src/C-interface/bml_export.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_EXPORT_H 4 | #define __BML_EXPORT_H 5 | 6 | #include "bml_types.h" 7 | 8 | void *bml_export_to_dense( 9 | bml_matrix_t * A, 10 | bml_dense_order_t order); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /docs/API/search/classes_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['bml_5fdomain_5ft_181',['bml_domain_t',['../structbml__domain__t.html',1,'']]], 4 | ['bml_5fmatrix_5fdimension_5ft_182',['bml_matrix_dimension_t',['../structbml__matrix__dimension__t.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | require 'json' 4 | require 'open-uri' 5 | 6 | versions = JSON.parse(open('https://pages.github.com/versions.json').read) 7 | 8 | gem 'github-pages', versions['github-pages'] 9 | 10 | gem 'jekyll-scholar' 11 | -------------------------------------------------------------------------------- /scripts/update_tags.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | basedir=$(readlink --canonicalize $(dirname $0)/..) 6 | pushd "${basedir}" 7 | readarray -t files < <(git ls-files '*.c' '*.h' '*.F90') 8 | ctags "${files[@]}" 9 | etags "${files[@]}" 10 | popd 11 | -------------------------------------------------------------------------------- /src/C-interface/bml_diagonalize.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_DIAGONALIZE_H 2 | #define __BML_DIAGONALIZE_H 3 | 4 | #include "bml_types.h" 5 | 6 | void bml_diagonalize( 7 | bml_matrix_t * A, 8 | void *eigenvalues, 9 | bml_matrix_t * eigenvectors); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /cmake/test_complex.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main( 5 | int argc, 6 | char **argv) 7 | { 8 | double complex x; 9 | 10 | x = 3.0 + 4.0 * _Complex_I; 11 | if (creal(x) == 3.0) 12 | { 13 | return 0; 14 | } 15 | return 1; 16 | } 17 | -------------------------------------------------------------------------------- /src/C-interface/bml_adjungate_triangle.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_ADJUNGATE_TRIANGLE_H 4 | #define __BML_ADJUNGATE_TRIANGLE_H 5 | 6 | #include "bml_types.h" 7 | 8 | void bml_adjungate_triangle( 9 | bml_matrix_t * A, 10 | char *triangle); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/C-interface/bml_transpose_triangle.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_TRANSPOSE_TRIANGLE_H 4 | #define __BML_TRANSPOSE_TRIANGLE_H 5 | 6 | #include "bml_types.h" 7 | 8 | void bml_transpose_triangle( 9 | bml_matrix_t * A, 10 | char triangle); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /docs/API/group__convert__group__C.js: -------------------------------------------------------------------------------- 1 | var group__convert__group__C = 2 | [ 3 | [ "bml_export_to_dense", "group__convert__group__C.html#ga287f7c9a50a4541ba28dadad4b3d432e", null ], 4 | [ "bml_import_from_dense", "group__convert__group__C.html#ga75fc0df803de9a52a93feaf91c0471eb", null ] 5 | ]; -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | defaults: 2 | - 3 | values: 4 | layout: "default" 5 | 6 | host: localhost 7 | baseurl: /bml 8 | exclude: [ Gemfile, Gemfile.lock, Makefile ] 9 | google_analytics: UA-108808764-1 10 | plugins: 11 | - jekyll-seo-tag 12 | 13 | theme: jekyll-theme-cayman 14 | -------------------------------------------------------------------------------- /src/C-interface/ellpack/bml_adjacency_ellpack.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_ADJACENCY_ELLPACK_H 2 | #define __BML_ADJACENCY_ELLPACK_H 3 | 4 | #include "bml_types_ellpack.h" 5 | 6 | 7 | void bml_adjacency_ellpack( 8 | bml_matrix_t * A, 9 | int *xadj, 10 | int *adjncy); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | build: 4 | os: ubuntu-20.04 5 | tools: 6 | python: "3.12" 7 | 8 | sphinx: 9 | configuration: docs/source/conf.py 10 | 11 | formats: 12 | - pdf 13 | - epub 14 | 15 | python: 16 | install: 17 | - requirements: docs/source/requirements.txt 18 | -------------------------------------------------------------------------------- /docs/API/search/typedefs_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['bml_5fmatrix_5ft_318',['bml_matrix_t',['../bml__types_8h.html#afe10f3a7e985a8627616dfda2dec6fc9',1,'bml_types.h']]], 4 | ['bml_5fvector_5ft_319',['bml_vector_t',['../bml__types_8h.html#a9d6f9ce8185b0741d087e196388df34a',1,'bml_types.h']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/API/search/all_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['fortran_20usage_151',['Fortran Usage',['../fortran_usage.html',1,'']]], 4 | ['future_20plans_152',['Future Plans',['../future_plans.html',1,'']]], 5 | ['fortran_20tests_153',['FORTRAN TESTS',['../md__bml_tests_Fortran-tests_README.html',1,'']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/API/search/pages_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['fortran_20usage_359',['Fortran Usage',['../fortran_usage.html',1,'']]], 4 | ['future_20plans_360',['Future Plans',['../future_plans.html',1,'']]], 5 | ['fortran_20tests_361',['FORTRAN TESTS',['../md__bml_tests_Fortran-tests_README.html',1,'']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /scripts/setenv_tulip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | module load PrgEnv-cray 4 | module load cce/11.0.3 5 | module load rocm/4.1.0 6 | module use /home/groups/coegroup/share/coe/modulefiles 7 | module load hipmagma 8 | module load cmake 9 | export LD_LIBRARY_PATH="$CRAY_LD_LIBRARY_PATH:$LD_LIBRARY_PATH" 10 | 11 | -------------------------------------------------------------------------------- /tests/Fortran-tests/precision.F90: -------------------------------------------------------------------------------- 1 | !> Presicion module 2 | !! \brief Simple and double precision definition. 3 | module prec 4 | 5 | implicit none 6 | 7 | private 8 | 9 | integer, parameter, public :: sp = kind(1.0) 10 | integer, parameter, public :: dp = kind(1.d0) 11 | 12 | end module prec 13 | -------------------------------------------------------------------------------- /docs/API/search/all_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['maxlocalextent_167',['maxLocalExtent',['../structbml__domain__t.html#a4bf31953afaacc7443266e0692708974',1,'bml_domain_t']]], 4 | ['minlocalextent_168',['minLocalExtent',['../structbml__domain__t.html#aebe028220c422c58dab4256105e514a9',1,'bml_domain_t']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/API/search/variables_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['maxlocalextent_309',['maxLocalExtent',['../structbml__domain__t.html#a4bf31953afaacc7443266e0692708974',1,'bml_domain_t']]], 4 | ['minlocalextent_310',['minLocalExtent',['../structbml__domain__t.html#aebe028220c422c58dab4256105e514a9',1,'bml_domain_t']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/API/bml__scale_8h.js: -------------------------------------------------------------------------------- 1 | var bml__scale_8h = 2 | [ 3 | [ "bml_scale", "bml__scale_8h.html#a40f2db1b47209d5e3d03a174377a9378", null ], 4 | [ "bml_scale_inplace", "bml__scale_8h.html#a9ec5eb05663f318269db8f7991a78a49", null ], 5 | [ "bml_scale_new", "bml__scale_8h.html#a214988e2c702bfa0ac57f522121e1707", null ] 6 | ]; -------------------------------------------------------------------------------- /src/C-interface/bml_transpose.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_TRANSPOSE_H 4 | #define __BML_TRANSPOSE_H 5 | 6 | #include "bml_types.h" 7 | 8 | // Transpose A - B = A^T 9 | bml_matrix_t *bml_transpose_new( 10 | bml_matrix_t * A); 11 | 12 | void bml_transpose( 13 | bml_matrix_t * A); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /tests/C-tests/test_backtrace.c: -------------------------------------------------------------------------------- 1 | #include "bml_logger.h" 2 | 3 | void 4 | foo( 5 | void) 6 | { 7 | LOG_DEBUG("Test function\n"); 8 | LOG_ERROR("Print backtrace\n"); 9 | } 10 | 11 | int 12 | main( 13 | int argc, 14 | char **argv) 15 | { 16 | LOG_INFO("Starting test...\n"); 17 | foo(); 18 | } 19 | -------------------------------------------------------------------------------- /docs/API/bml__getters_8h.js: -------------------------------------------------------------------------------- 1 | var bml__getters_8h = 2 | [ 3 | [ "bml_get_diagonal", "bml__getters_8h.html#a89c57ba46736aba58f0f95ddf2cda6a8", null ], 4 | [ "bml_get_element", "bml__getters_8h.html#af948cfa1c575c16472d2cd193180bb91", null ], 5 | [ "bml_get_row", "bml__getters_8h.html#a58e90e7930ef8faf7f934d5f390bed8f", null ] 6 | ]; -------------------------------------------------------------------------------- /docs/API/search/all_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['ellblock_149',['ellblock',['../bml__types_8h.html#ab7d3c21318898af00e7c28712f369842a5f22e1eeefdb33ea7810804347747fee',1,'bml_types.h']]], 4 | ['ellpack_150',['ellpack',['../bml__types_8h.html#ab7d3c21318898af00e7c28712f369842a24b256c25cebbc6eda1078275b3dbd48',1,'bml_types.h']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/API/search/enumvalues_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['ellblock_337',['ellblock',['../bml__types_8h.html#ab7d3c21318898af00e7c28712f369842a5f22e1eeefdb33ea7810804347747fee',1,'bml_types.h']]], 4 | ['ellpack_338',['ellpack',['../bml__types_8h.html#ab7d3c21318898af00e7c28712f369842a24b256c25cebbc6eda1078275b3dbd48',1,'bml_types.h']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_logger_m.F90: -------------------------------------------------------------------------------- 1 | module bml_logger_m 2 | 3 | use bml_c_interface_m 4 | 5 | implicit none 6 | private 7 | public :: bml_print_version 8 | 9 | contains 10 | 11 | subroutine bml_print_version() 12 | call bml_print_version_C() 13 | end subroutine bml_print_version 14 | 15 | end module bml_logger_m 16 | -------------------------------------------------------------------------------- /src/C-interface/bml_threshold.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_THRESHOLD_H 4 | #define __BML_THRESHOLD_H 5 | 6 | #include "bml_types.h" 7 | 8 | bml_matrix_t *bml_threshold_new( 9 | bml_matrix_t * A, 10 | double threshold); 11 | 12 | void bml_threshold( 13 | bml_matrix_t * A, 14 | double threshold); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/C-interface/bml_init.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_INIT_H 4 | #define __BML_INIT_H 5 | 6 | #include "bml_types.h" 7 | 8 | #ifdef BML_USE_MPI 9 | #include 10 | #endif 11 | 12 | void bml_init( 13 | #ifdef BML_USE_MPI 14 | MPI_Comm comm 15 | #endif 16 | ); 17 | 18 | void bml_initF( 19 | int fcomm); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/C-interface/bml_trace.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_TRACE_H 4 | #define __BML_TRACE_H 5 | 6 | #include "bml_types.h" 7 | 8 | // Calculate trace of A 9 | double bml_trace( 10 | bml_matrix_t * A); 11 | 12 | // Calculate trace of matrix mult 13 | double bml_trace_mult( 14 | bml_matrix_t * A, 15 | bml_matrix_t * B); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/C-interface/bml_convert.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_CONVERT_H 4 | #define __BML_CONVERT_H 5 | 6 | #include "bml_types.h" 7 | 8 | bml_matrix_t *bml_convert( 9 | bml_matrix_t * A, 10 | bml_matrix_type_t matrix_type, 11 | bml_matrix_precision_t matrix_precision, 12 | int M, 13 | bml_distribution_mode_t distrib_mode); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /tests/C-tests/test_openmp_offload.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main( 5 | int argc, 6 | char **argv) 7 | { 8 | int is_device = 1; 9 | 10 | #pragma omp target map(from : is_device) 11 | { 12 | is_device = omp_is_initial_device(); 13 | } 14 | 15 | // returns 0 if executed on device, 1 otherwise 16 | return is_device; 17 | } 18 | -------------------------------------------------------------------------------- /src/bml.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 3 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 4 | 5 | Name: bml 6 | Description: The basic matrix library 7 | URL: https://lanl.github.io/bml/ 8 | Version: @PROJECT_VERSION@ 9 | Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@ 10 | Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lbml_fortran -lbml @LINKLINE@ 11 | -------------------------------------------------------------------------------- /scripts/run-local-docker-container.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | : ${IMAGE:=nicolasbock/bml:latest} 4 | 5 | docker pull "${IMAGE}" || echo "cannot pull image ${IMAGE}" 6 | docker run --rm \ 7 | $( (( $# == 0 )) && echo "--interactive --tty") \ 8 | --volume "${PWD}":/bml \ 9 | --workdir /bml \ 10 | ${IMAGE} sudo --user ubuntu $( (( $# == 0 )) && echo "bash --login" ) "$@" 11 | -------------------------------------------------------------------------------- /src/C-interface/bml_element_multiply.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_ELEMNET_MULTIPLY_H 4 | #define __BML_ELEMNET_MULTIPLY_H 5 | 6 | #include "bml_types.h" 7 | 8 | // Element-wise Matrix multiply (Hadamard product) 9 | void bml_element_multiply_AB( 10 | bml_matrix_t * A, 11 | bml_matrix_t * B, 12 | bml_matrix_t * C, 13 | double threshold); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/C-interface/bml_getters.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_GETTERS_H 4 | #define __BML_GETTERS_H 5 | 6 | #include "bml_types.h" 7 | 8 | void *bml_get_element( 9 | bml_matrix_t * A, 10 | int i, 11 | int j); 12 | 13 | void *bml_get_row( 14 | bml_matrix_t * A, 15 | int i); 16 | 17 | void *bml_get_diagonal( 18 | bml_matrix_t * A); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_convert_distributed2d.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_CONVERT_DISTRIBUTED_H 2 | #define __BML_CONVERT_DISTRIBUTED_H 3 | 4 | #include "bml_types_distributed2d.h" 5 | 6 | bml_matrix_distributed2d_t *bml_convert_distributed2d( 7 | bml_matrix_t * A, 8 | bml_matrix_type_t matrix_type, 9 | bml_matrix_precision_t matrix_precision, 10 | int M); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/C-interface/ellpack/bml_adjacency_ellpack.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../bml_logger.h" 3 | #include "../bml_types.h" 4 | #include "bml_types_ellpack.h" 5 | #include 6 | #include 7 | 8 | void 9 | bml_adjacency_ellpack( 10 | bml_matrix_t * A, 11 | int *xadj, 12 | int *adjncy) 13 | { 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tests/Fortran-tests/prec.F90: -------------------------------------------------------------------------------- 1 | module prec 2 | 3 | use bml 4 | 5 | implicit none 6 | 7 | private 8 | 9 | integer, parameter, public :: sp = kind(1.0) 10 | integer, parameter, public :: dp = kind(1.0d0) 11 | character(20), parameter, public :: bml_real = bml_element_real 12 | character(20), parameter, public :: bml_complex = bml_element_complex 13 | 14 | 15 | end module prec 16 | -------------------------------------------------------------------------------- /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ;;; Directory Local Variables 2 | ;;; For more information see (info "(emacs) Directory Variables") 3 | 4 | ((c-mode . (((c-basic-offset . 4) . ((c-offsets-alist 5 | (arglist-intro . 4)))))) 6 | (f90-mode . ((f90-type-indent . 2) 7 | (f90-do-indent . 2) 8 | (f90-if-indent . 2))) 9 | (sh-mode . ((sh-basic-offset . 4)))) 10 | -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_transpose_distributed2d.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_TRANSPOSE_DISTRIBUTED2D_H 2 | #define __BML_TRANSPOSE_DISTRIBUTED2D_H 3 | 4 | #include "bml_types_distributed2d.h" 5 | 6 | bml_matrix_distributed2d_t *bml_transpose_new_distributed2d( 7 | bml_matrix_distributed2d_t * A); 8 | 9 | void bml_transpose_distributed2d( 10 | bml_matrix_distributed2d_t * A); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /docs/API/search/groups_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['converting_20between_20matrix_20formats_20_28c_20interface_29_353',['Converting between Matrix Formats (C interface)',['../group__convert__group__C.html',1,'']]], 4 | ['converting_20between_20matrix_20formats_20_28fortran_20interface_29_354',['Converting between Matrix Formats (Fortran interface)',['../group__convert__group__Fortran.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_trace_distributed2d.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_TRACE_DISTRIBUTED2D_H 2 | #define __BML_TRACE_DISTRIBUTED2D_H 3 | 4 | #include "bml_types_distributed2d.h" 5 | 6 | double bml_trace_distributed2d( 7 | bml_matrix_distributed2d_t * A); 8 | 9 | double bml_trace_mult_distributed2d( 10 | bml_matrix_distributed2d_t * A, 11 | bml_matrix_distributed2d_t * B); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /docs/API/search/variables_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['totalcols_315',['totalCols',['../structbml__domain__t.html#a9512ab8921c7a31087da060314b71fa7',1,'bml_domain_t']]], 4 | ['totalprocs_316',['totalProcs',['../structbml__domain__t.html#af3ea182ec3b2edaeaffa18175b843004',1,'bml_domain_t']]], 5 | ['totalrows_317',['totalRows',['../structbml__domain__t.html#a9f8e69933c32dde2313422311abb4769',1,'bml_domain_t']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/API/bml__setters_8h.js: -------------------------------------------------------------------------------- 1 | var bml__setters_8h = 2 | [ 3 | [ "bml_set_diagonal", "bml__setters_8h.html#a32e2d795549f145709201a042825ec1c", null ], 4 | [ "bml_set_element", "bml__setters_8h.html#aaa1decf96475d48d6a3ded6ac3613573", null ], 5 | [ "bml_set_element_new", "bml__setters_8h.html#afd2d5339fb794592df556dcaf82fb137", null ], 6 | [ "bml_set_row", "bml__setters_8h.html#a1f7c441f4b86299560e9b3d4d53be6ed", null ] 7 | ]; -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_utilities_distributed2d.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_UTILITIES_DISTRIBUTED2D_H 2 | #define __BML_UTILITIES_DISTRIBUTED2D_H 3 | 4 | #include "bml_types_distributed2d.h" 5 | 6 | void bml_read_bml_matrix_distributed2d( 7 | bml_matrix_distributed2d_t * A, 8 | char *filename); 9 | 10 | void bml_write_bml_matrix_distributed2d( 11 | bml_matrix_distributed2d_t * A, 12 | char *filename); 13 | #endif 14 | -------------------------------------------------------------------------------- /docs/API/bml__add_8h.js: -------------------------------------------------------------------------------- 1 | var bml__add_8h = 2 | [ 3 | [ "bml_add", "group__add__group__C.html#gaa8c6400c76b9dc933e39e73e22453e81", null ], 4 | [ "bml_add_identity", "group__add__group__C.html#ga651e318df7483f0fd57fb154bf1e873f", null ], 5 | [ "bml_add_norm", "group__add__group__C.html#gaeb7ff9c3ec65086a8b07939703389488", null ], 6 | [ "bml_scale_add_identity", "group__add__group__C.html#gad6439ff73109138ef3eff301401286e8", null ] 7 | ]; -------------------------------------------------------------------------------- /docs/API/bml__multiply_8h.js: -------------------------------------------------------------------------------- 1 | var bml__multiply_8h = 2 | [ 3 | [ "bml_multiply", "bml__multiply_8h.html#a321dab9437e71b1f0a0728937698c97c", null ], 4 | [ "bml_multiply_AB", "bml__multiply_8h.html#ac832aeed57fbc4fed3fa1d32dfc46cf7", null ], 5 | [ "bml_multiply_adjust_AB", "bml__multiply_8h.html#a71162da85d1f0367120b4a9ac643a3a3", null ], 6 | [ "bml_multiply_x2", "bml__multiply_8h.html#a3a1944b2ad37ef716a0a1671fea4e0bc", null ] 7 | ]; -------------------------------------------------------------------------------- /docs/API/search/variables_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['globalrowextent_301',['globalRowExtent',['../structbml__domain__t.html#a05b8cf1bab79d166a8f1ece0665d78a1',1,'bml_domain_t']]], 4 | ['globalrowmax_302',['globalRowMax',['../structbml__domain__t.html#a4596991a533c8bb1c6fc0b0d92c0ec83',1,'bml_domain_t']]], 5 | ['globalrowmin_303',['globalRowMin',['../structbml__domain__t.html#a2193ab88f14f700b079ae1b44d518f05',1,'bml_domain_t']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /src/C-interface/bml_import.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_IMPORT_H 4 | #define __BML_IMPORT_H 5 | 6 | #include "bml_types.h" 7 | 8 | bml_matrix_t *bml_import_from_dense( 9 | bml_matrix_type_t matrix_type, 10 | bml_matrix_precision_t matrix_precision, 11 | bml_dense_order_t order, 12 | int N, 13 | int M, 14 | void *A, 15 | double threshold, 16 | bml_distribution_mode_t distrib_mode); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/C-interface/bml_scale.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_SCALE_H 4 | #define __BML_SCALE_H 5 | 6 | #include "bml_types.h" 7 | 8 | bml_matrix_t *bml_scale_new( 9 | void *scale_factor, 10 | bml_matrix_t * A); 11 | 12 | void bml_scale( 13 | void *scale_factor, 14 | bml_matrix_t * A, 15 | bml_matrix_t * B); 16 | 17 | void bml_scale_inplace( 18 | void *scale_factor, 19 | bml_matrix_t * A); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /docs/API/bml__normalize_8h.js: -------------------------------------------------------------------------------- 1 | var bml__normalize_8h = 2 | [ 3 | [ "bml_accumulate_offdiag", "bml__normalize_8h.html#a5959525a156fbfd96ba4900953188a9d", null ], 4 | [ "bml_gershgorin", "bml__normalize_8h.html#aa75eaf96a480fa5bc84f895c729d2b93", null ], 5 | [ "bml_gershgorin_partial", "bml__normalize_8h.html#a355405d0e49e5096d08b5c6c6b884319", null ], 6 | [ "bml_normalize", "bml__normalize_8h.html#a9f176dae39c3375697bc397b8b9e3f55", null ] 7 | ]; -------------------------------------------------------------------------------- /scripts/setenv_tulip_offload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | module load craype-accel-amd-gfx908 4 | module unload cray-mvapich2 cray-libsci 5 | module use /home/groups/coegroup/share/coe/modulefiles 6 | module load rocm/4.1.1 7 | module swap cce cce/11.0.4 8 | module load ompi/4.1.0/cce/11.0.4/rocm/4.1.1 9 | module load blas 10 | #module load rocm/4.2.0 11 | module load cmake 12 | export LD_LIBRARY_PATH="$CRAY_LD_LIBRARY_PATH:$LD_LIBRARY_PATH" 13 | 14 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "nicolasbock/bml:latest", 3 | "customizations": { 4 | "vscode": { 5 | "extensions": [ 6 | "fortran-lang.linter-gfortran", 7 | "GitHub.vscode-pull-request-github", 8 | "ms-vscode.cmake-tools", 9 | "ms-vscode.cpptools-extension-pack", 10 | "ms-vscode.cpptools", 11 | "redhat.vscode-yaml", 12 | "twxs.cmake" 13 | ] 14 | } 15 | }, 16 | "remoteUser": "ubuntu" 17 | } 18 | -------------------------------------------------------------------------------- /docs/API/group__add__group__C.js: -------------------------------------------------------------------------------- 1 | var group__add__group__C = 2 | [ 3 | [ "bml_add", "group__add__group__C.html#gaa8c6400c76b9dc933e39e73e22453e81", null ], 4 | [ "bml_add_identity", "group__add__group__C.html#ga651e318df7483f0fd57fb154bf1e873f", null ], 5 | [ "bml_add_norm", "group__add__group__C.html#gaeb7ff9c3ec65086a8b07939703389488", null ], 6 | [ "bml_scale_add_identity", "group__add__group__C.html#gad6439ff73109138ef3eff301401286e8", null ] 7 | ]; -------------------------------------------------------------------------------- /scripts/install_rocsparse_headers_olcf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | this_dir=$(pwd) 4 | if [[ ! -e src/C-interface || $this_dir == *build ]]; then 5 | echo "Please run this script in the bml/ root directory" 6 | exit 1 7 | fi 8 | cp -r $ROCM_PATH/include/rocsparse src/C-interface/. 9 | sed -i -e 's/\[\[.*//' src/C-interface/rocsparse/rocsparse-functions.h 10 | sed -i -e 's/.*\]\] ROCSPARSE_EXPORT/ROCSPARSE_EXPORT/' src/C-interface/rocsparse/rocsparse-functions.h 11 | -------------------------------------------------------------------------------- /cmake/bmlAddTypedLibrary.cmake: -------------------------------------------------------------------------------- 1 | macro(bml_add_typed_library TARGET MATRIX_PRECISION SOURCES) 2 | set(TYPED_TARGET ${TARGET}-${MATRIX_PRECISION}) 3 | message(STATUS "Adding typed library ${TYPED_TARGET}") 4 | add_library(${TYPED_TARGET} OBJECT ${SOURCES}) 5 | string(TOUPPER ${MATRIX_PRECISION} PRECISION_DEF) 6 | set_target_properties(${TYPED_TARGET} 7 | PROPERTIES 8 | COMPILE_DEFINITIONS ${PRECISION_DEF} 9 | POSITION_INDEPENDENT_CODE yes) 10 | endmacro() 11 | -------------------------------------------------------------------------------- /docs/API/bml__copy_8h.js: -------------------------------------------------------------------------------- 1 | var bml__copy_8h = 2 | [ 3 | [ "bml_copy", "bml__copy_8h.html#ac085c5247157c8a2133de2c7b9222b7c", null ], 4 | [ "bml_copy_new", "bml__copy_8h.html#a9ae0e957c2e1c8a38fd4b9076b3dd1ac", null ], 5 | [ "bml_reorder", "bml__copy_8h.html#a85658741451e0f82d61a89fef927994d", null ], 6 | [ "bml_restore_domain", "bml__copy_8h.html#ace101d071a90b8b49ddeafcb2d38fdc5", null ], 7 | [ "bml_save_domain", "bml__copy_8h.html#a0c2853d4c5be208711f26a280e8a8a82", null ] 8 | ]; -------------------------------------------------------------------------------- /src/Fortran-interface/bml_threshold_m.F90: -------------------------------------------------------------------------------- 1 | module bml_threshold_m 2 | 3 | use bml_c_interface_m 4 | use bml_types_m 5 | 6 | implicit none 7 | private 8 | 9 | public :: bml_threshold 10 | 11 | contains 12 | 13 | subroutine bml_threshold(a, threshold) 14 | 15 | type(bml_matrix_t), intent(inout) :: a 16 | real(C_DOUBLE), intent(in) :: threshold 17 | 18 | call bml_threshold_C(a%ptr, threshold) 19 | 20 | end subroutine bml_threshold 21 | 22 | end module bml_threshold_m 23 | -------------------------------------------------------------------------------- /docs/API/search/all_b.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['sequential_174',['sequential',['../bml__types_8h.html#a4bed60baf88d95c03a021ed4b166a522a6864d880b222253becc42d7b15cb946a',1,'bml_types.h']]], 4 | ['single_5fcomplex_175',['single_complex',['../bml__types_8h.html#a8d762ed64876f48d5eb687cb62f20d5ca1e3cccb950b0263ba0c1ddd6495031d5',1,'bml_types.h']]], 5 | ['single_5freal_176',['single_real',['../bml__types_8h.html#a8d762ed64876f48d5eb687cb62f20d5cab1dee362b4b8fac13bfc3e3df1d88af0',1,'bml_types.h']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_shutdown_m.F90: -------------------------------------------------------------------------------- 1 | !> Shutdown bml. 2 | module bml_shutdown_m 3 | 4 | use bml_c_interface_m 5 | use bml_types_m 6 | 7 | #ifdef BML_USE_MPI 8 | use mpi 9 | #endif 10 | 11 | implicit none 12 | private 13 | 14 | public :: bml_shutdownF 15 | 16 | contains 17 | 18 | !> Shutdown from Fortran when using MPI. 19 | !! 20 | subroutine bml_shutdownF() 21 | 22 | call bml_shutdownF_C() 23 | 24 | end subroutine bml_shutdownF 25 | 26 | end module bml_shutdown_m 27 | -------------------------------------------------------------------------------- /docs/API/search/enumvalues_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['sequential_341',['sequential',['../bml__types_8h.html#a4bed60baf88d95c03a021ed4b166a522a6864d880b222253becc42d7b15cb946a',1,'bml_types.h']]], 4 | ['single_5fcomplex_342',['single_complex',['../bml__types_8h.html#a8d762ed64876f48d5eb687cb62f20d5ca1e3cccb950b0263ba0c1ddd6495031d5',1,'bml_types.h']]], 5 | ['single_5freal_343',['single_real',['../bml__types_8h.html#a8d762ed64876f48d5eb687cb62f20d5cab1dee362b4b8fac13bfc3e3df1d88af0',1,'bml_types.h']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/API/search/defines_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['log_5fdebug_345',['LOG_DEBUG',['../bml__logger_8h.html#abd0b0523397fb05f0ed46fc217fb630f',1,'bml_logger.h']]], 4 | ['log_5ferror_346',['LOG_ERROR',['../bml__logger_8h.html#abffaf9cecb61026cac6db71a16ace9c5',1,'bml_logger.h']]], 5 | ['log_5finfo_347',['LOG_INFO',['../bml__logger_8h.html#a89681da4efde0b54dc7f2839665082c8',1,'bml_logger.h']]], 6 | ['log_5fwarn_348',['LOG_WARN',['../bml__logger_8h.html#a31e7ff3be0d7ddbd843b3335b534bd03',1,'bml_logger.h']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /cmake/FindELPA.cmake: -------------------------------------------------------------------------------- 1 | # - Find the ELPA library 2 | # 3 | # Usage: 4 | # find_package(ELPA [REQUIRED] [QUIET] ) 5 | # 6 | # It sets the following variables: 7 | # ELPA_FOUND ... true if elpa is found on the system 8 | # ELPA_LIBRARY_DIRS ... full path to elpa library 9 | # ELPA_INCLUDE_DIRS ... elpa include directory 10 | # ELPA_LIBRARIES ... elpa libraries 11 | 12 | 13 | find_package(PkgConfig REQUIRED) 14 | pkg_check_modules(ELPA REQUIRED elpa IMPORTED_TARGET) 15 | 16 | -------------------------------------------------------------------------------- /examples/example4/Makefile: -------------------------------------------------------------------------------- 1 | 2 | BML_PATH = $(HOME)/bml/install/lib/ 3 | CC = gcc 4 | CFLAGS = -I${BML_PATH}/../include -fopenmp 5 | LINK = -L${BML_PATH} -lbml -lbml_fortran -llapack -lblas -lm 6 | 7 | #For the Cray environment: 8 | #BML_PATH = $(SCRATCH)/bml/install/lib64 9 | #CC = cc 10 | #CFLAGS = -I${BML_PATH}/../include -qopenmp -dynamic 11 | #LINK = -g -dynamic -qopt-report=5 -axMIC-AVX512,CORE-AVX2 -L${BML_PATH} -lbml -lbml_fortran -lm 12 | 13 | main: main.o 14 | $(CC) $(CFLAGS) -o main main.o $(LINK) 15 | -------------------------------------------------------------------------------- /docs/API/search/nomatches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
No Matches
10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /scripts/magma_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | module load gcc/5.4.0 3 | module load netlib-lapack/3.6.1 4 | module load magma/2.2.0 5 | module load cuda/8.0.54 6 | module load cmake/3.6.1 7 | 8 | # Make sure all the paths are correct 9 | 10 | rm -r build 11 | rm -r install 12 | 13 | MY_PATH=$(pwd) 14 | 15 | export BML_OPENMP=${BML_OPENMP:=no} 16 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 17 | export BML_MAGMA=${BML_MAGMA:=yes} 18 | export MAGMA_ROOT=$OLCF_MAGMA_ROOT 19 | 20 | ./build.sh testing 21 | #./build.sh install 22 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. BML documentation master file, created by 2 | sphinx-quickstart on Tue Jan 25 16:29:49 2022. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to BML's documentation! 7 | =============================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :caption: Contents: 12 | 13 | .. include:: ../../README.rst 14 | 15 | Indices and tables 16 | ================== 17 | 18 | * :ref:`genindex` 19 | * :ref:`modindex` 20 | * :ref:`search` 21 | -------------------------------------------------------------------------------- /src/C-interface/bml_copy.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_COPY_H 4 | #define __BML_COPY_H 5 | 6 | #include "bml_types.h" 7 | 8 | bml_matrix_t *bml_copy_new( 9 | bml_matrix_t * A); 10 | 11 | void bml_copy( 12 | bml_matrix_t * A, 13 | bml_matrix_t * B); 14 | 15 | void bml_reorder( 16 | bml_matrix_t * A, 17 | int *perm); 18 | 19 | void bml_copy_domain( 20 | bml_domain_t * A, 21 | bml_domain_t * B); 22 | 23 | void bml_save_domain( 24 | bml_matrix_t * A); 25 | 26 | void bml_restore_domain( 27 | bml_matrix_t * A); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /docs/API/search/all_c.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['totalcols_177',['totalCols',['../structbml__domain__t.html#a9512ab8921c7a31087da060314b71fa7',1,'bml_domain_t']]], 4 | ['totalprocs_178',['totalProcs',['../structbml__domain__t.html#af3ea182ec3b2edaeaffa18175b843004',1,'bml_domain_t']]], 5 | ['totalrows_179',['totalRows',['../structbml__domain__t.html#a9f8e69933c32dde2313422311abb4769',1,'bml_domain_t']]], 6 | ['type_5funinitialized_180',['type_uninitialized',['../bml__types_8h.html#ab7d3c21318898af00e7c28712f369842ae96fd391f81a83d544ac43e7d59c2ee1',1,'bml_types.h']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /docs/API/bml__norm_8h.js: -------------------------------------------------------------------------------- 1 | var bml__norm_8h = 2 | [ 3 | [ "bml_fnorm", "bml__norm_8h.html#a6fb791703b9dc12713f715dc1b37da2c", null ], 4 | [ "bml_fnorm2", "bml__norm_8h.html#a17db5f5d0bcb1e7d8bfd8cde1d8611a5", null ], 5 | [ "bml_sum_AB", "bml__norm_8h.html#a2a6dbf3d77d990714499e6c525e75fa3", null ], 6 | [ "bml_sum_squares", "bml__norm_8h.html#a78a41eb60c15e6015f49781b3ab21716", null ], 7 | [ "bml_sum_squares2", "bml__norm_8h.html#a06bf3428243be284c82fd8e097611a0f", null ], 8 | [ "bml_sum_squares_submatrix", "bml__norm_8h.html#ac3aa87dccc95164a1a7f592546ec14fa", null ] 9 | ]; -------------------------------------------------------------------------------- /docs/API/structbml__matrix__dimension__t.js: -------------------------------------------------------------------------------- 1 | var structbml__matrix__dimension__t = 2 | [ 3 | [ "bsizes", "structbml__matrix__dimension__t.html#a9c7bc98a3ba08b6116eb3f88cad158be", null ], 4 | [ "N_cols", "structbml__matrix__dimension__t.html#ae93d93be8edd8d58fdfdaa622f9063fa", null ], 5 | [ "N_nz_max", "structbml__matrix__dimension__t.html#a5117085a9592cff35612f591a6da002f", null ], 6 | [ "N_rows", "structbml__matrix__dimension__t.html#a99f5c19ff573126acae515047b11d82e", null ], 7 | [ "NB", "structbml__matrix__dimension__t.html#a92125c526198bc6d2d0dbe056e359d3b", null ] 8 | ]; -------------------------------------------------------------------------------- /src/C-interface/csr/bml_inverse_csr.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_INVERSE_CSR_H 2 | #define __BML_INVERSE_CSR_H 3 | 4 | #include "bml_types_csr.h" 5 | 6 | bml_matrix_csr_t *bml_inverse_csr( 7 | bml_matrix_csr_t * A); 8 | 9 | bml_matrix_csr_t *bml_inverse_csr_single_real( 10 | bml_matrix_csr_t * A); 11 | 12 | bml_matrix_csr_t *bml_inverse_csr_double_real( 13 | bml_matrix_csr_t * A); 14 | 15 | bml_matrix_csr_t *bml_inverse_csr_single_complex( 16 | bml_matrix_csr_t * A); 17 | 18 | bml_matrix_csr_t *bml_inverse_csr_double_complex( 19 | bml_matrix_csr_t * A); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /docs/API/search/all_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['n_5fcols_169',['N_cols',['../structbml__matrix__dimension__t.html#ae93d93be8edd8d58fdfdaa622f9063fa',1,'bml_matrix_dimension_t']]], 4 | ['n_5fnz_5fmax_170',['N_nz_max',['../structbml__matrix__dimension__t.html#a5117085a9592cff35612f591a6da002f',1,'bml_matrix_dimension_t']]], 5 | ['n_5frows_171',['N_rows',['../structbml__matrix__dimension__t.html#a99f5c19ff573126acae515047b11d82e',1,'bml_matrix_dimension_t']]], 6 | ['nb_172',['NB',['../structbml__matrix__dimension__t.html#a92125c526198bc6d2d0dbe056e359d3b',1,'bml_matrix_dimension_t']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /docs/API/search/all_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['globalrowextent_154',['globalRowExtent',['../structbml__domain__t.html#a05b8cf1bab79d166a8f1ece0665d78a1',1,'bml_domain_t']]], 4 | ['globalrowmax_155',['globalRowMax',['../structbml__domain__t.html#a4596991a533c8bb1c6fc0b0d92c0ec83',1,'bml_domain_t']]], 5 | ['globalrowmin_156',['globalRowMin',['../structbml__domain__t.html#a2193ab88f14f700b079ae1b44d518f05',1,'bml_domain_t']]], 6 | ['graph_5fdistributed_157',['graph_distributed',['../bml__types_8h.html#a4bed60baf88d95c03a021ed4b166a522ab84cdcec3965486fa6e115f45c3e3ce2',1,'bml_types.h']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /docs/API/search/variables_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['n_5fcols_311',['N_cols',['../structbml__matrix__dimension__t.html#ae93d93be8edd8d58fdfdaa622f9063fa',1,'bml_matrix_dimension_t']]], 4 | ['n_5fnz_5fmax_312',['N_nz_max',['../structbml__matrix__dimension__t.html#a5117085a9592cff35612f591a6da002f',1,'bml_matrix_dimension_t']]], 5 | ['n_5frows_313',['N_rows',['../structbml__matrix__dimension__t.html#a99f5c19ff573126acae515047b11d82e',1,'bml_matrix_dimension_t']]], 6 | ['nb_314',['NB',['../structbml__matrix__dimension__t.html#a92125c526198bc6d2d0dbe056e359d3b',1,'bml_matrix_dimension_t']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /scripts/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | debug=0 4 | 5 | while [ $# -gt 0 ]; do 6 | case $1 in 7 | --debug) 8 | debug=1 9 | ;; 10 | *) 11 | # Ignoring 12 | ;; 13 | esac 14 | shift 15 | done 16 | 17 | if [ ${debug} -ne 0 ]; then 18 | set -x 19 | fi 20 | 21 | if ! ./scripts/run-local-docker-container.sh ./build.sh indent > ./indent.output 2>&1; then 22 | cat < Matrix inverse functions. 2 | module bml_inverse_m 3 | 4 | use bml_c_interface_m 5 | use bml_introspection_m 6 | use bml_types_m 7 | 8 | implicit none 9 | private 10 | 11 | public :: bml_inverse 12 | 13 | contains 14 | 15 | !> Matrix inverse. 16 | !! 17 | !! @param a The matrix. 18 | !! @param b The inverse of matrix a 19 | subroutine bml_inverse(a, b) 20 | 21 | type(bml_matrix_t), intent(in) :: a 22 | type(bml_matrix_t), intent(inout) :: b 23 | 24 | call bml_deallocate(b) 25 | b%ptr = bml_inverse_C(a%ptr) 26 | 27 | end subroutine bml_inverse 28 | 29 | end module bml_inverse_m 30 | -------------------------------------------------------------------------------- /src/C-interface/bml_elemental.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_ELEMENTAL 2 | #define __BML_ELEMENTAL 3 | 4 | #include "bml_types.h" 5 | 6 | #ifdef BML_COMPLEX 7 | #include 8 | #endif 9 | 10 | float bml_get_element_single_real( 11 | bml_matrix_t * A, 12 | int i, 13 | int j); 14 | 15 | double bml_get_element_double_real( 16 | bml_matrix_t * A, 17 | int i, 18 | int j); 19 | 20 | #ifdef BML_COMPLEX 21 | float complex bml_get_element_single_complex( 22 | bml_matrix_t * A, 23 | int i, 24 | int j); 25 | 26 | double complex bml_get_element_double_complex( 27 | bml_matrix_t * A, 28 | int i, 29 | int j); 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /docs/API/search/groups_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['add_20functions_20_28c_20interface_29_349',['Add Functions (C interface)',['../group__add__group__C.html',1,'']]], 4 | ['add_20functions_20_28fortran_20interface_29_350',['Add Functions (Fortran interface)',['../group__add__group__Fortran.html',1,'']]], 5 | ['allocation_20and_20deallocation_20functions_20_28c_20interface_29_351',['Allocation and Deallocation Functions (C interface)',['../group__allocate__group__C.html',1,'']]], 6 | ['allocation_20and_20deallocation_20functions_20_28fortran_20interface_29_352',['Allocation and Deallocation Functions (Fortran interface)',['../group__allocate__group__Fortran.html',1,'']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /examples/example2/Makefile: -------------------------------------------------------------------------------- 1 | #Assumes environment variable PKG_CONFIG_PATH includes 2 | #path to bml.pc, for instance, with a cshell 3 | #setenv PKG_CONFIG_PATH $PKG_CONFIG_PATH":$HOME/GIT/bml/install/lib64/pkgconfig" 4 | 5 | CXXFLAGS += `pkg-config --cflags bml` 6 | LIBS+=`pkg-config --libs bml` -fopenmp 7 | 8 | # how to produce objects from source files 9 | 10 | %.o:%.cc 11 | $(CXX) $(CXXFLAGS) -c $< 12 | 13 | TARGET = ./main 14 | 15 | all: $(TARGET) 16 | 17 | OBJS = main.o 18 | 19 | # dependencies 20 | $(TARGET): $(OBJS) 21 | 22 | # rules 23 | 24 | $(TARGET): $(OBJS) 25 | $(CXX) -o $(TARGET) $(OBJS) $(LIBS) 26 | 27 | clean: 28 | rm -f *.o 29 | rm -f main 30 | 31 | -------------------------------------------------------------------------------- /docs/API/search/variables_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['localdispl_304',['localDispl',['../structbml__domain__t.html#acb9190cb6c82b27f0d5ca8266ad3688f',1,'bml_domain_t']]], 4 | ['localelements_305',['localElements',['../structbml__domain__t.html#a11da61b7f6cdfffeee90c055bd2ccd62',1,'bml_domain_t']]], 5 | ['localrowextent_306',['localRowExtent',['../structbml__domain__t.html#a587a4b292cb6278115500bf495eca5b4',1,'bml_domain_t']]], 6 | ['localrowmax_307',['localRowMax',['../structbml__domain__t.html#a4eb3339f51b2754baee5b66419e98c12',1,'bml_domain_t']]], 7 | ['localrowmin_308',['localRowMin',['../structbml__domain__t.html#ac4a952e1dd5dd37776a67004579deab5',1,'bml_domain_t']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /src/C-interface/ellblock/bml_inverse_ellblock.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_INVERSE_ELLBLOCK_H 2 | #define __BML_INVERSE_ELLBLOCK_H 3 | 4 | #include "bml_types_ellblock.h" 5 | 6 | bml_matrix_ellblock_t *bml_inverse_ellblock( 7 | bml_matrix_ellblock_t * A); 8 | 9 | bml_matrix_ellblock_t *bml_inverse_ellblock_single_real( 10 | bml_matrix_ellblock_t * A); 11 | 12 | bml_matrix_ellblock_t *bml_inverse_ellblock_double_real( 13 | bml_matrix_ellblock_t * A); 14 | 15 | bml_matrix_ellblock_t 16 | * bml_inverse_ellblock_single_complex(bml_matrix_ellblock_t * A); 17 | 18 | bml_matrix_ellblock_t 19 | * bml_inverse_ellblock_double_complex(bml_matrix_ellblock_t * A); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /docs/API/search/enumvalues_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['bml_5flog_5fdebug_325',['BML_LOG_DEBUG',['../bml__logger_8h.html#a4e5211e771917d13c27085693bbdbc6daf1d31b5d6a42c70657683645e421ec01',1,'bml_logger.h']]], 4 | ['bml_5flog_5ferror_326',['BML_LOG_ERROR',['../bml__logger_8h.html#a4e5211e771917d13c27085693bbdbc6da10730f0c0bb49ada3b16514e9c673434',1,'bml_logger.h']]], 5 | ['bml_5flog_5finfo_327',['BML_LOG_INFO',['../bml__logger_8h.html#a4e5211e771917d13c27085693bbdbc6da9baa6897682f6da747eee2be719cf1aa',1,'bml_logger.h']]], 6 | ['bml_5flog_5fwarning_328',['BML_LOG_WARNING',['../bml__logger_8h.html#a4e5211e771917d13c27085693bbdbc6da40859472376c63243c29b57b621dd548',1,'bml_logger.h']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /docs/API/modules.js: -------------------------------------------------------------------------------- 1 | var modules = 2 | [ 3 | [ "Allocation and Deallocation Functions (C interface)", "group__allocate__group__C.html", "group__allocate__group__C" ], 4 | [ "Add Functions (C interface)", "group__add__group__C.html", "group__add__group__C" ], 5 | [ "Converting between Matrix Formats (C interface)", "group__convert__group__C.html", "group__convert__group__C" ], 6 | [ "Allocation and Deallocation Functions (Fortran interface)", "group__allocate__group__Fortran.html", null ], 7 | [ "Add Functions (Fortran interface)", "group__add__group__Fortran.html", null ], 8 | [ "Converting between Matrix Formats (Fortran interface)", "group__convert__group__Fortran.html", null ] 9 | ]; -------------------------------------------------------------------------------- /src/BMLConfig.cmakein: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | if(@OPENMP_FOUND@) 3 | enable_language(C) 4 | find_dependency(OpenMP COMPONENTS C REQUIRED) 5 | endif() 6 | if(@hip_FOUND@) 7 | find_dependency(hip REQUIRED) 8 | endif() 9 | if(@rocblas_FOUND@) 10 | find_dependency(rocblas REQUIRED) 11 | endif() 12 | if(@hipblas_FOUND@) 13 | find_dependency(hipblas REQUIRED) 14 | endif() 15 | if(@hipsparse_FOUND@) 16 | find_dependency(hipsparse REQUIRED) 17 | endif() 18 | if(@rocsolver_FOUND@) 19 | find_dependency(rocsolver REQUIRED) 20 | endif() 21 | if(@rocsparse_FOUND@) 22 | find_dependency(rocsparse REQUIRED) 23 | endif() 24 | include("${CMAKE_CURRENT_LIST_DIR}/BML_Targets.cmake") 25 | -------------------------------------------------------------------------------- /src/C-interface/bml_add.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_ADD_H 4 | #define __BML_ADD_H 5 | 6 | #include "bml_types.h" 7 | 8 | void bml_add( 9 | bml_matrix_t * A, 10 | bml_matrix_t * B, 11 | double alpha, 12 | double beta, 13 | double threshold); 14 | 15 | double bml_add_norm( 16 | bml_matrix_t * A, 17 | bml_matrix_t * B, 18 | double alpha, 19 | double beta, 20 | double threshold); 21 | 22 | void bml_add_identity( 23 | bml_matrix_t * A, 24 | double beta, 25 | double threshold); 26 | 27 | void bml_scale_add_identity( 28 | bml_matrix_t * A, 29 | double alpha, 30 | double beta, 31 | double threshold); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /test-getter/ptr.F90: -------------------------------------------------------------------------------- 1 | program ptr 2 | 3 | use, intrinsic :: iso_C_binding 4 | use bml 5 | 6 | type(bml_matrix_t) :: a 7 | real(C_FLOAT), allocatable :: diagonal(:) 8 | real(C_FLOAT), allocatable :: row(:) 9 | 10 | call bml_random_matrix(BML_MATRIX_ELLPACK, BML_ELEMENT_REAL, C_FLOAT, 10, 10, A, BML_DMODE_SEQUENTIAL) 11 | !call bml_identity_matrix(BML_MATRIX_ELLPACK, BML_ELEMENT_REAL, C_FLOAT, 10, 10, A, BML_DMODE_SEQUENTIAL) 12 | call bml_get_diagonal(A, diagonal) 13 | call bml_get_row(A, 1, row) 14 | 15 | call bml_print_matrix("A", A, 0, 10, 0, 10) 16 | write(*, *) "diagonal =", diagonal 17 | write(*, *) "row =", row 18 | 19 | call bml_deallocate(A) 20 | 21 | end program ptr 22 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_init_m.F90: -------------------------------------------------------------------------------- 1 | !> Initialize bml. 2 | module bml_init_m 3 | 4 | use bml_c_interface_m 5 | use bml_types_m 6 | use, intrinsic :: iso_C_binding 7 | 8 | implicit none 9 | private 10 | 11 | public :: bml_initF 12 | 13 | contains 14 | 15 | !> Initialize from Fortran when using MPI. 16 | !! 17 | !! \param fcomm MPI communicator from Fortran 18 | subroutine bml_initF(fcomm) 19 | 20 | integer(C_INT), intent(in), optional :: fcomm 21 | integer :: arg_comm 22 | 23 | if(present(fcomm)) then 24 | arg_comm = fcomm 25 | else 26 | arg_comm = 0 27 | end if 28 | call bml_initF_C(arg_comm) 29 | 30 | end subroutine bml_initF 31 | 32 | end module bml_init_m 33 | -------------------------------------------------------------------------------- /src/C-interface/csr/bml_export_csr.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_EXPORT_CSR_H 2 | #define __BML_EXPORT_CSR_H 3 | 4 | #include "bml_types_csr.h" 5 | 6 | void *bml_export_to_dense_csr( 7 | bml_matrix_csr_t * A, 8 | bml_dense_order_t order); 9 | 10 | void *bml_export_to_dense_csr_single_real( 11 | bml_matrix_csr_t * A, 12 | bml_dense_order_t order); 13 | 14 | void *bml_export_to_dense_csr_double_real( 15 | bml_matrix_csr_t * A, 16 | bml_dense_order_t order); 17 | 18 | void *bml_export_to_dense_csr_single_complex( 19 | bml_matrix_csr_t * A, 20 | bml_dense_order_t order); 21 | 22 | void *bml_export_to_dense_csr_double_complex( 23 | bml_matrix_csr_t * A, 24 | bml_dense_order_t order); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /docs/API/search/enums_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['bml_5fdense_5forder_5ft_320',['bml_dense_order_t',['../bml__types_8h.html#aee75766924480bd077ae554927c85233',1,'bml_types.h']]], 4 | ['bml_5fdistribution_5fmode_5ft_321',['bml_distribution_mode_t',['../bml__types_8h.html#a4bed60baf88d95c03a021ed4b166a522',1,'bml_types.h']]], 5 | ['bml_5flog_5flevel_5ft_322',['bml_log_level_t',['../bml__logger_8h.html#a4e5211e771917d13c27085693bbdbc6d',1,'bml_logger.h']]], 6 | ['bml_5fmatrix_5fprecision_5ft_323',['bml_matrix_precision_t',['../bml__types_8h.html#a8d762ed64876f48d5eb687cb62f20d5c',1,'bml_types.h']]], 7 | ['bml_5fmatrix_5ftype_5ft_324',['bml_matrix_type_t',['../bml__types_8h.html#ab7d3c21318898af00e7c28712f369842',1,'bml_types.h']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /tests/C-tests/test_template_typed.c: -------------------------------------------------------------------------------- 1 | #include "bml.h" 2 | #include "../typed.h" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int TYPED_FUNC( 10 | test_template) ( 11 | const int N, 12 | const bml_matrix_type_t matrix_type, 13 | const bml_matrix_precision_t matrix_precision, 14 | const int M) 15 | { 16 | bml_matrix_t *A = NULL; 17 | REAL_T *array = NULL; 18 | 19 | // Add code here ... 20 | A = bml_random_matrix(matrix_type, matrix_precision, N, M, sequential); 21 | 22 | // Don't forget to release the memory ... 23 | bml_deallocate(&A); 24 | free(array); 25 | 26 | LOG_INFO("test_template passed\n"); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /scripts/build_crusher_offload_cce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure all the paths are correct 4 | 5 | rm -r build 6 | rm -r install 7 | 8 | MY_PATH=$(pwd) 9 | 10 | export CC=${CC:=cc} 11 | export FC=${FC:=ftn} 12 | export CXX=${CXX:=CC} 13 | export BLA_VENDOR=${BLA_VENDOR:=OpenBLAS} 14 | export BML_OPENMP=${BML_OPENMP:=yes} 15 | export BML_OMP_OFFLOAD=${BML_OMP_OFFLOAD:=yes} 16 | export BML_OFFLOAD_ARCH=${BML_OFFLOAD_ARCH:=AMD} 17 | export BUILD_DIR=${BUILD_DIR:="${MY_PATH}/build"} 18 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 19 | export BML_TESTING=${BML_TESTING:=yes} 20 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 21 | 22 | ./build.sh configure 23 | 24 | pushd ${BUILD_DIR} 25 | make -j16 26 | make install 27 | popd 28 | -------------------------------------------------------------------------------- /src/C-interface/dense/bml_elemental_dense.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_ELEMENTAL_DENSE_H 2 | #define __BML_ELEMENTAL_DENSE_H 3 | 4 | #include "bml_types_dense.h" 5 | 6 | #ifdef BML_COMPLEX 7 | #include 8 | #endif 9 | 10 | float bml_get_element_dense_single_real( 11 | bml_matrix_dense_t * A, 12 | int i, 13 | int j); 14 | 15 | double bml_get_element_dense_double_real( 16 | bml_matrix_dense_t * A, 17 | int i, 18 | int j); 19 | 20 | #ifdef BML_COMPLEX 21 | float complex bml_get_element_dense_single_complex( 22 | bml_matrix_dense_t * A, 23 | int i, 24 | int j); 25 | 26 | double complex bml_get_element_dense_double_complex( 27 | bml_matrix_dense_t * A, 28 | int i, 29 | int j); 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/C-interface/dense/bml_transpose_triangle_dense.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_TRANSPOSE_TRIANGLE_DENSE_H 2 | #define __BML_TRANSPOSE_TRIANGLE_DENSE_H 3 | 4 | #include "bml_types_dense.h" 5 | 6 | void bml_transpose_triangle_dense( 7 | bml_matrix_dense_t * A, 8 | char triangle); 9 | 10 | void bml_transpose_triangle_dense_single_real( 11 | bml_matrix_dense_t * A, 12 | char triangle); 13 | 14 | void bml_transpose_triangle_dense_double_real( 15 | bml_matrix_dense_t * A, 16 | char triangle); 17 | 18 | void bml_transpose_triangle_dense_single_complex( 19 | bml_matrix_dense_t * A, 20 | char triangle); 21 | 22 | void bml_transpose_triangle_dense_double_complex( 23 | bml_matrix_dense_t * A, 24 | char triangle); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_getters_distributed2d.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_GETTERS_DISTRIBUTED2D_H 2 | #define __BML_GETTERS_DISTRIBUTED2D_H 3 | 4 | #include "bml_types_distributed2d.h" 5 | 6 | void *bml_get_row_distributed2d( 7 | bml_matrix_distributed2d_t * A, 8 | int i); 9 | 10 | void *bml_get_row_distributed2d_single_real( 11 | bml_matrix_distributed2d_t * A, 12 | int i); 13 | 14 | void *bml_get_row_distributed2d_double_real( 15 | bml_matrix_distributed2d_t * A, 16 | int i); 17 | 18 | void *bml_get_row_distributed2d_single_complex( 19 | bml_matrix_distributed2d_t * A, 20 | int i); 21 | 22 | void *bml_get_row_distributed2d_double_complex( 23 | bml_matrix_distributed2d_t * A, 24 | int i); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/C-interface/dense/bml_adjungate_triangle_dense.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_ADJUNGATE_TRIANGLE_DENSE_H 2 | #define __BML_ADJUNGATE_TRIANGLE_DENSE_H 3 | 4 | #include "bml_types_dense.h" 5 | 6 | void bml_adjungate_triangle_dense( 7 | bml_matrix_dense_t * A, 8 | char *triangle); 9 | 10 | void bml_adjungate_triangle_dense_single_real( 11 | bml_matrix_dense_t * A, 12 | char *triangle); 13 | 14 | void bml_adjungate_triangle_dense_double_real( 15 | bml_matrix_dense_t * A, 16 | char *triangle); 17 | 18 | void bml_adjungate_triangle_dense_single_complex( 19 | bml_matrix_dense_t * A, 20 | char *triangle); 21 | 22 | void bml_adjungate_triangle_dense_double_complex( 23 | bml_matrix_dense_t * A, 24 | char *triangle); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/C-interface/dense/bml_export_dense.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_EXPORT_DENSE_H 2 | #define __BML_EXPORT_DENSE_H 3 | 4 | #include "bml_types_dense.h" 5 | 6 | void *bml_export_to_dense_dense( 7 | bml_matrix_dense_t * A, 8 | bml_dense_order_t order); 9 | 10 | void *bml_export_to_dense_dense_single_real( 11 | bml_matrix_dense_t * A, 12 | bml_dense_order_t order); 13 | 14 | void *bml_export_to_dense_dense_double_real( 15 | bml_matrix_dense_t * A, 16 | bml_dense_order_t order); 17 | 18 | void *bml_export_to_dense_dense_single_complex( 19 | bml_matrix_dense_t * A, 20 | bml_dense_order_t order); 21 | 22 | void *bml_export_to_dense_dense_double_complex( 23 | bml_matrix_dense_t * A, 24 | bml_dense_order_t order); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_adjungate_triangle_m.F90: -------------------------------------------------------------------------------- 1 | !> Adjungate_triangle functions. 2 | module bml_adjungate_triangle_m 3 | 4 | use bml_c_interface_m 5 | use bml_types_m 6 | 7 | implicit none 8 | private 9 | 10 | public :: bml_adjungate_triangle 11 | 12 | contains 13 | 14 | !> Adjungates the triangle of a matrix. 15 | !! 16 | !! \param a The matrix. 17 | !! \param triangle Which triangle to adjungate ('u': upper, 'l': lower) 18 | subroutine bml_adjungate_triangle(a, triangle) 19 | 20 | type(bml_matrix_t), intent(inout) :: a 21 | character(C_CHAR), intent(in) :: triangle 22 | 23 | call bml_adjungate_triangle_C(a%ptr, triangle) 24 | 25 | end subroutine bml_adjungate_triangle 26 | 27 | end module bml_adjungate_triangle_m 28 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_transpose_triangle_m.F90: -------------------------------------------------------------------------------- 1 | !> Transpose_triangle functions. 2 | module bml_transpose_triangle_m 3 | 4 | use bml_c_interface_m 5 | use bml_types_m 6 | 7 | implicit none 8 | private 9 | 10 | public :: bml_transpose_triangle 11 | 12 | contains 13 | 14 | !> Transposes the triangle of a matrix. 15 | !! 16 | !! \param a The matrix. 17 | !! \param triangle Which triangle to transpose ('u': upper, 'l': lower) 18 | subroutine bml_transpose_triangle(a, triangle) 19 | 20 | type(bml_matrix_t), intent(inout) :: a 21 | character(C_CHAR), intent(in) :: triangle 22 | 23 | call bml_transpose_triangle_C(a%ptr, triangle) 24 | 25 | end subroutine bml_transpose_triangle 26 | 27 | end module bml_transpose_triangle_m 28 | -------------------------------------------------------------------------------- /tests/Fortran-tests/example_template_typed.F90: -------------------------------------------------------------------------------- 1 | module example_template_typed 2 | 3 | use bml 4 | use prec 5 | use bml_example_template_m 6 | 7 | implicit none 8 | 9 | public :: test_example_template_typed 10 | 11 | contains 12 | 13 | function test_example_template_typed(matrix_type, element_kind, element_precision,& 14 | & n, m) result(test_result) 15 | 16 | character(len=*), intent(in) :: matrix_type, element_kind 17 | integer, intent(in) :: element_precision 18 | integer, intent(in) :: n, m 19 | logical :: test_result 20 | DUMMY_KIND(DUMMY_PREC) :: variable 21 | 22 | variable = 1.0_DM 23 | 24 | ! ADD YOUR TEST HERE 25 | 26 | end function test_example_template_typed 27 | 28 | end module example_template_typed 29 | -------------------------------------------------------------------------------- /scripts/ci-gcc-10-C-double-real.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | for READLINK in readlink greadlink; do 6 | if ${READLINK} --canonicalize ${HOME}; then 7 | break 8 | fi 9 | done 10 | 11 | basedir=$(${READLINK} --canonicalize $(dirname $0)/..) 12 | 13 | export CC=${CC:-gcc-10} 14 | export CXX=${CXX:-g++-10} 15 | export FC=${FC:-gfortran-10} 16 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 17 | export BML_OPENMP=${BML_OPENMP:-no} 18 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 19 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R C-.*-double_real"} 20 | export BML_VALGRIND=${BML_VALGRIND:-yes} 21 | 22 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 23 | 24 | ${basedir}/build.sh --debug testing 25 | -------------------------------------------------------------------------------- /scripts/ci-gcc-10-C-single-real.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | for READLINK in readlink greadlink; do 6 | if ${READLINK} --canonicalize ${HOME}; then 7 | break 8 | fi 9 | done 10 | 11 | basedir=$(${READLINK} --canonicalize $(dirname $0)/..) 12 | 13 | export CC=${CC:-gcc-10} 14 | export CXX=${CXX:-g++-10} 15 | export FC=${FC:-gfortran-10} 16 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 17 | export BML_OPENMP=${BML_OPENMP:-no} 18 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 19 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R C-.*-single_real"} 20 | export BML_VALGRIND=${BML_VALGRIND:-yes} 21 | 22 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 23 | 24 | ${basedir}/build.sh --debug testing 25 | -------------------------------------------------------------------------------- /scripts/ci-gcc-14-C-double-real.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | for READLINK in readlink greadlink; do 6 | if ${READLINK} --canonicalize ${HOME}; then 7 | break 8 | fi 9 | done 10 | 11 | basedir=$(${READLINK} --canonicalize $(dirname $0)/..) 12 | 13 | export CC=${CC:-gcc-14} 14 | export CXX=${CXX:-g++-14} 15 | export FC=${FC:-gfortran-14} 16 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 17 | export BML_OPENMP=${BML_OPENMP:-no} 18 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 19 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R C-.*-double_real"} 20 | export BML_VALGRIND=${BML_VALGRIND:-yes} 21 | 22 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 23 | 24 | ${basedir}/build.sh --debug testing 25 | -------------------------------------------------------------------------------- /scripts/ci-gcc-14-C-single-real.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | for READLINK in readlink greadlink; do 6 | if ${READLINK} --canonicalize ${HOME}; then 7 | break 8 | fi 9 | done 10 | 11 | basedir=$(${READLINK} --canonicalize $(dirname $0)/..) 12 | 13 | export CC=${CC:-gcc-14} 14 | export CXX=${CXX:-g++-14} 15 | export FC=${FC:-gfortran-14} 16 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 17 | export BML_OPENMP=${BML_OPENMP:-no} 18 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 19 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R C-.*-single_real"} 20 | export BML_VALGRIND=${BML_VALGRIND:-yes} 21 | 22 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 23 | 24 | ${basedir}/build.sh --debug testing 25 | -------------------------------------------------------------------------------- /src/C-interface/ellpack/bml_elemental_ellpack.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_ELEMENTAL_ELLPACK_H 2 | #define __BML_ELEMENTAL_ELLPACK_H 3 | 4 | #include "bml_types_ellpack.h" 5 | 6 | #ifdef BML_COMPLEX 7 | #include 8 | #endif 9 | 10 | float bml_get_element_ellpack_single_real( 11 | bml_matrix_ellpack_t * A, 12 | int i, 13 | int j); 14 | 15 | double bml_get_element_ellpack_double_real( 16 | bml_matrix_ellpack_t * A, 17 | int i, 18 | int j); 19 | 20 | #ifdef BML_COMPLEX 21 | float complex bml_get_element_ellpack_single_complex( 22 | bml_matrix_ellpack_t * A, 23 | int i, 24 | int j); 25 | 26 | double complex bml_get_element_ellpack_double_complex( 27 | bml_matrix_ellpack_t * A, 28 | int i, 29 | int j); 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /scripts/ci-gcc-10-C-double-complex.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | for READLINK in readlink greadlink; do 6 | if ${READLINK} --canonicalize ${HOME}; then 7 | break 8 | fi 9 | done 10 | 11 | basedir=$(${READLINK} --canonicalize $(dirname $0)/..) 12 | 13 | export CC=${CC:-gcc-10} 14 | export CXX=${CXX:-g++-10} 15 | export FC=${FC:-gfortran-10} 16 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 17 | export BML_OPENMP=${BML_OPENMP:-no} 18 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 19 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R C-.*-double_complex"} 20 | export BML_VALGRIND=${BML_VALGRIND:-yes} 21 | 22 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 23 | 24 | ${basedir}/build.sh --debug testing 25 | -------------------------------------------------------------------------------- /scripts/ci-gcc-10-C-single-complex.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | for READLINK in readlink greadlink; do 6 | if ${READLINK} --canonicalize ${HOME}; then 7 | break 8 | fi 9 | done 10 | 11 | basedir=$(${READLINK} --canonicalize $(dirname $0)/..) 12 | 13 | export CC=${CC:-gcc-10} 14 | export CXX=${CXX:-g++-10} 15 | export FC=${FC:-gfortran-10} 16 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 17 | export BML_OPENMP=${BML_OPENMP:-no} 18 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 19 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R C-.*-single_complex"} 20 | export BML_VALGRIND=${BML_VALGRIND:-yes} 21 | 22 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 23 | 24 | ${basedir}/build.sh --debug testing 25 | -------------------------------------------------------------------------------- /scripts/ci-gcc-14-C-double-complex.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | for READLINK in readlink greadlink; do 6 | if ${READLINK} --canonicalize ${HOME}; then 7 | break 8 | fi 9 | done 10 | 11 | basedir=$(${READLINK} --canonicalize $(dirname $0)/..) 12 | 13 | export CC=${CC:-gcc-14} 14 | export CXX=${CXX:-g++-14} 15 | export FC=${FC:-gfortran-14} 16 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 17 | export BML_OPENMP=${BML_OPENMP:-no} 18 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 19 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R C-.*-double_complex"} 20 | export BML_VALGRIND=${BML_VALGRIND:-yes} 21 | 22 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 23 | 24 | ${basedir}/build.sh --debug testing 25 | -------------------------------------------------------------------------------- /scripts/ci-gcc-14-C-single-complex.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | for READLINK in readlink greadlink; do 6 | if ${READLINK} --canonicalize ${HOME}; then 7 | break 8 | fi 9 | done 10 | 11 | basedir=$(${READLINK} --canonicalize $(dirname $0)/..) 12 | 13 | export CC=${CC:-gcc-14} 14 | export CXX=${CXX:-g++-14} 15 | export FC=${FC:-gfortran-14} 16 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 17 | export BML_OPENMP=${BML_OPENMP:-no} 18 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 19 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R C-.*-single_complex"} 20 | export BML_VALGRIND=${BML_VALGRIND:-yes} 21 | 22 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 23 | 24 | ${basedir}/build.sh --debug testing 25 | -------------------------------------------------------------------------------- /scripts/ci-MPI-double-real.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | basedir=$(readlink --canonicalize $(dirname $0)/..) 6 | 7 | export CC=${CC:-mpicc} 8 | export CXX=${CXX:-mpic++} 9 | export FC=${FC:-mpifort} 10 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 11 | export BML_OPENMP=${BML_OPENMP:-no} 12 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 13 | export BML_MPI=${BML_MPI:-yes} 14 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R MPI-C-.*-double_real"} 15 | export BML_SCALAPACK=${BML_SCALAPACK:-yes} 16 | export SCALAPACK_LIBRARIES=${SCALAPACK_LIBRARIES:=scalapack-openmpi.so} 17 | export BML_MPIEXEC_PREFLAGS=--oversubscribe 18 | 19 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 20 | 21 | ${basedir}/build.sh --debug testing 22 | -------------------------------------------------------------------------------- /scripts/ci-MPI-single-real.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | basedir=$(readlink --canonicalize $(dirname $0)/..) 6 | 7 | export CC=${CC:-mpicc} 8 | export CXX=${CXX:-mpic++} 9 | export FC=${FC:-mpifort} 10 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 11 | export BML_OPENMP=${BML_OPENMP:-no} 12 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 13 | export BML_MPI=${BML_MPI:-yes} 14 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R MPI-C-.*-single_real"} 15 | export BML_SCALAPACK=${BML_SCALAPACK:-yes} 16 | export SCALAPACK_LIBRARIES=${SCALAPACK_LIBRARIES:=scalapack-openmpi.so} 17 | export BML_MPIEXEC_PREFLAGS=--oversubscribe 18 | 19 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 20 | 21 | ${basedir}/build.sh --debug testing 22 | -------------------------------------------------------------------------------- /src/C-interface/ellpack/bml_export_ellpack.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_EXPORT_ELLPACK_H 2 | #define __BML_EXPORT_ELLPACK_H 3 | 4 | #include "bml_types_ellpack.h" 5 | 6 | void *bml_export_to_dense_ellpack( 7 | bml_matrix_ellpack_t * A, 8 | bml_dense_order_t order); 9 | 10 | void *bml_export_to_dense_ellpack_single_real( 11 | bml_matrix_ellpack_t * A, 12 | bml_dense_order_t order); 13 | 14 | void *bml_export_to_dense_ellpack_double_real( 15 | bml_matrix_ellpack_t * A, 16 | bml_dense_order_t order); 17 | 18 | void *bml_export_to_dense_ellpack_single_complex( 19 | bml_matrix_ellpack_t * A, 20 | bml_dense_order_t order); 21 | 22 | void *bml_export_to_dense_ellpack_double_complex( 23 | bml_matrix_ellpack_t * A, 24 | bml_dense_order_t order); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /scripts/ci-MPI-double-complex.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | basedir=$(readlink --canonicalize $(dirname $0)/..) 6 | 7 | export CC=${CC:-mpicc} 8 | export CXX=${CXX:-mpic++} 9 | export FC=${FC:-mpifort} 10 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 11 | export BML_OPENMP=${BML_OPENMP:-no} 12 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 13 | export BML_MPI=${BML_MPI:-yes} 14 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R MPI-C-.*-double_complex"} 15 | export BML_SCALAPACK=${BML_SCALAPACK:-yes} 16 | export SCALAPACK_LIBRARIES=${SCALAPACK_LIBRARIES:=scalapack-openmpi.so} 17 | export BML_MPIEXEC_PREFLAGS=--oversubscribe 18 | 19 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 20 | 21 | ${basedir}/build.sh --debug testing 22 | -------------------------------------------------------------------------------- /scripts/ci-MPI-single-complex.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -u -x 4 | 5 | basedir=$(readlink --canonicalize $(dirname $0)/..) 6 | 7 | export CC=${CC:-mpicc} 8 | export CXX=${CXX:-mpic++} 9 | export FC=${FC:-mpifort} 10 | export BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-no} 11 | export BML_OPENMP=${BML_OPENMP:-no} 12 | export BML_INTERNAL_BLAS=${BML_INTERNAL_BLAS:-no} 13 | export BML_MPI=${BML_MPI:-yes} 14 | export TESTING_EXTRA_ARGS=${TESTING_EXTRA_ARGS:-"-R MPI-C-.*-single_complex"} 15 | export BML_SCALAPACK=${BML_SCALAPACK:-yes} 16 | export SCALAPACK_LIBRARIES=${SCALAPACK_LIBRARIES:=scalapack-openmpi.so} 17 | export BML_MPIEXEC_PREFLAGS=--oversubscribe 18 | 19 | [[ -f ${basedir}/scripts/ci-defaults.sh ]] && . ${basedir}/scripts/ci-defaults.sh 20 | 21 | ${basedir}/build.sh --debug testing 22 | -------------------------------------------------------------------------------- /scripts/build_spock_offload_cce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure all the paths are correct 4 | 5 | rm -r build 6 | rm -r install 7 | 8 | MY_PATH=$(pwd) 9 | 10 | export CC=${CC:=cc} 11 | export FC=${FC:=ftn} 12 | export CXX=${CXX:=CC} 13 | export BLA_VENDOR=${BLA_VENDOR:=OpenBLAS} 14 | export BML_OPENMP=${BML_OPENMP:=yes} 15 | export BML_OMP_OFFLOAD=${BML_OMP_OFFLOAD:=yes} 16 | export BML_OFFLOAD_ARCH=${BML_OFFLOAD_ARCH:=AMD} 17 | export BML_COMPLEX=${BML_COMPLEX:=no} 18 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 19 | export BML_MAGMA=${BML_MAGMA:=no} 20 | export MAGMA_ROOT=${MAGMA_HOME} 21 | export BML_TESTING=${BML_TESTING:=yes} 22 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 23 | 24 | ./build.sh configure 25 | 26 | pushd build 27 | make -j8 28 | make install 29 | popd 30 | -------------------------------------------------------------------------------- /src/C-interface/ellblock/bml_export_ellblock.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_EXPORT_ELLBLOCK_H 2 | #define __BML_EXPORT_ELLBLOCK_H 3 | 4 | #include "bml_types_ellblock.h" 5 | 6 | void *bml_export_to_dense_ellblock( 7 | bml_matrix_ellblock_t * A, 8 | bml_dense_order_t order); 9 | 10 | void *bml_export_to_dense_ellblock_single_real( 11 | bml_matrix_ellblock_t * A, 12 | bml_dense_order_t order); 13 | 14 | void *bml_export_to_dense_ellblock_double_real( 15 | bml_matrix_ellblock_t * A, 16 | bml_dense_order_t order); 17 | 18 | void *bml_export_to_dense_ellblock_single_complex( 19 | bml_matrix_ellblock_t * A, 20 | bml_dense_order_t order); 21 | 22 | void *bml_export_to_dense_ellblock_double_complex( 23 | bml_matrix_ellblock_t * A, 24 | bml_dense_order_t order); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_introspection_distributed2d.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_INTROSPECTION_DISTRIBUTED2D_H 2 | #define __BML_INTROSPECTION_DISTRIBUTED2D_H 3 | 4 | #include "bml_types_distributed2d.h" 5 | 6 | bml_matrix_precision_t bml_get_precision_distributed2d( 7 | bml_matrix_distributed2d_t * A); 8 | 9 | bml_distribution_mode_t bml_get_distribution_mode_distributed2d( 10 | bml_matrix_distributed2d_t * A); 11 | 12 | int bml_get_N_distributed2d( 13 | bml_matrix_distributed2d_t * A); 14 | 15 | int bml_get_M_distributed2d( 16 | bml_matrix_distributed2d_t * A); 17 | 18 | bml_matrix_t *bml_get_local_matrix_distributed2d( 19 | bml_matrix_distributed2d_t * A); 20 | 21 | double bml_get_sparsity_distributed2d( 22 | bml_matrix_distributed2d_t * A, 23 | double threshold); 24 | #endif 25 | -------------------------------------------------------------------------------- /src/C-interface/ellpack/bml_adjungate_triangle_ellpack.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_ADJUNGATE_TRIANGLE_ELLPACK_H 4 | #define __BML_ADJUNGATE_TRIANGLE_ELLPACK_H 5 | 6 | #include "bml_types_ellpack.h" 7 | 8 | void bml_adjungate_triangle_ellpack( 9 | bml_matrix_ellpack_t * A, 10 | char *triangle); 11 | 12 | void bml_adjungate_triangle_ellpack_single_real( 13 | bml_matrix_ellpack_t * A, 14 | char *triangle); 15 | 16 | void bml_adjungate_triangle_ellpack_double_real( 17 | bml_matrix_ellpack_t * A, 18 | char *triangle); 19 | 20 | void bml_adjungate_triangle_ellpack_single_complex( 21 | bml_matrix_ellpack_t * A, 22 | char *triangle); 23 | 24 | void bml_adjungate_triangle_ellpack_double_complex( 25 | bml_matrix_ellpack_t * A, 26 | char *triangle); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /docs/API/search/searchdata.js: -------------------------------------------------------------------------------- 1 | var indexSectionsWithContent = 2 | { 3 | 0: "abcdefglmnpst", 4 | 1: "b", 5 | 2: "b", 6 | 3: "b", 7 | 4: "bglmnt", 8 | 5: "b", 9 | 6: "b", 10 | 7: "bcdegpst", 11 | 8: "l", 12 | 9: "ac", 13 | 10: "bcdf" 14 | }; 15 | 16 | var indexSectionNames = 17 | { 18 | 0: "all", 19 | 1: "classes", 20 | 2: "files", 21 | 3: "functions", 22 | 4: "variables", 23 | 5: "typedefs", 24 | 6: "enums", 25 | 7: "enumvalues", 26 | 8: "defines", 27 | 9: "groups", 28 | 10: "pages" 29 | }; 30 | 31 | var indexSectionLabels = 32 | { 33 | 0: "All", 34 | 1: "Classes", 35 | 2: "Files", 36 | 3: "Functions", 37 | 4: "Variables", 38 | 5: "Typedefs", 39 | 6: "Enumerations", 40 | 7: "Enumerator", 41 | 8: "Macros", 42 | 9: "Modules", 43 | 10: "Pages" 44 | }; 45 | 46 | -------------------------------------------------------------------------------- /scripts/build_tulip_magma_cce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure all the paths are correct 4 | 5 | rm -r build 6 | rm -r install 7 | 8 | MY_PATH=$(pwd) 9 | 10 | export CC=${CC:=cc} 11 | export FC=${FC:=ftn} 12 | export CXX=${CXX:=CC} 13 | export BLAS_VENDOR=${BLAS_VENDOR:=Auto} 14 | export BML_OPENMP=${BML_OPENMP:=yes} 15 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 16 | export BML_MAGMA=${BML_MAGMA:=yes} 17 | export MAGMA_ROOT=${MAGMA_HOME} 18 | export BML_TESTING=${BML_TESTING:=yes} 19 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 20 | export CMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS:="-ef -DCRAY_SDK"} 21 | export EXTRA_CFLAGS=${EXTRA_CFLAGS:="-DCRAY_SDK"} 22 | export EXTRA_LINK_FLAGS=${EXTRA_LINK_FLAGS:=""} 23 | 24 | ./build.sh configure 25 | 26 | pushd build 27 | make -j8 28 | make install 29 | popd 30 | -------------------------------------------------------------------------------- /docs/API/bml__utilities_8h.js: -------------------------------------------------------------------------------- 1 | var bml__utilities_8h = 2 | [ 3 | [ "PRINT_THRESHOLD", "bml__utilities_8h.html#a8d0ac7033fb1bd905e0215fadfb69c57", null ], 4 | [ "bml_print_bml_matrix", "bml__utilities_8h.html#ad4de58c7dbc719120733c7caca20db49", null ], 5 | [ "bml_print_bml_vector", "bml__utilities_8h.html#affd749f81dd284459f95fd9e5072d49e", null ], 6 | [ "bml_print_dense_matrix", "bml__utilities_8h.html#a9f51d6ec2bc0109ae0677e3e1c3806b5", null ], 7 | [ "bml_print_dense_vector", "bml__utilities_8h.html#af15258cd8da4415d492fd8ef005fd951", null ], 8 | [ "bml_read_bml_matrix", "bml__utilities_8h.html#a03cdb2dd9c6b1aa1747a3deab690c281", null ], 9 | [ "bml_sqrtint", "bml__utilities_8h.html#a2ad96db749cab024d83489cafe70883c", null ], 10 | [ "bml_write_bml_matrix", "bml__utilities_8h.html#ae80010a9a582ccdd81500357ffb8f505", null ] 11 | ]; -------------------------------------------------------------------------------- /examples/example3/Makefile: -------------------------------------------------------------------------------- 1 | BML_DIR=$(HOME)/bml/install 2 | F90 = gfortran 3 | F90FLAGS += -fopenmp -I/$(BML_DIR)/include -L/$(BML_DIR)/lib/ -lbml_fortran -lbml 4 | LIBS+= -llapack -lblas -fopenmp 5 | LIBS+= -L/$(BML_DIR)/lib/ -lbml_fortran -lbml 6 | 7 | # how to produce objects from source files 8 | 9 | %.o:%.f90 10 | $(F90) $(F90FLAGS) -c $< 11 | 12 | %.o:%.f95 13 | $(F90) $(F90FLAGS) -c $< 14 | 15 | %.o:%.f 16 | $(F77) $(F77FLAGS) -c $< 17 | 18 | # General vars 19 | 20 | TARGET = ./main 21 | 22 | all: $(TARGET) 23 | 24 | PROGRAM = main.o 25 | 26 | OBJS = $(PROGRAM) $(MODULES) 27 | 28 | # dependencies 29 | 30 | $(MODULES) : 31 | $(PROGRAM) : $(MODULES) 32 | 33 | # rules 34 | 35 | $(TARGET): $(MODULES) $(PROGRAM) 36 | $(F90) -o $(TARGET) $(LINKFLAGS) $(OBJS) $(LIBS) $(LIBSP) 37 | 38 | clean: 39 | rm -f *.o *.mod 40 | rm -f main 41 | -------------------------------------------------------------------------------- /scripts/offload_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure all the paths are correct 4 | 5 | rm -r build 6 | rm -r install 7 | 8 | MY_PATH=$(pwd) 9 | 10 | export CC=${CC:=gcc} 11 | export FC=${FC:=gfortran} 12 | export CXX=${CXX:=g++} 13 | export BLAS_VENDOR=${BLAS_VENDOR:=MKL} 14 | export BML_OPENMP=${BML_OPENMP:=yes} 15 | export BML_OMP_OFFLOAD=${BML_OMP_OFFLOAD:=yes} 16 | export BML_MAGMA=${BML_MAGMA:=no} 17 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 18 | export BML_TESTING=${BML_TESTING:=yes} 19 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 20 | export EXTRA_CFLAGS=${EXTRA_CFLAGS:=""} 21 | export EXTRA_LINK_FLAGS=${EXTRA_LINK_FLAGS:=""} 22 | export CUDA_TOOLKIT_ROOT_DIR=${CUDADIR} 23 | export CMAKE_Fortran_FLAGS="-fopenmp -foffload=nvptx-none" 24 | export CMAKE_C_FLAGS="-O3 -fopenmp -foffload=nvptx-none" 25 | ./build.sh install 26 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml.F90: -------------------------------------------------------------------------------- 1 | !> Main matrix library module. 2 | !! 3 | !! Use this modules in order to use the library. 4 | module bml 5 | use bml_add_m 6 | use bml_adjungate_triangle_m 7 | use bml_allocate_m 8 | use bml_copy_m 9 | use bml_diagonalize_m 10 | use bml_elemental_m 11 | use bml_error_m 12 | use bml_export_m 13 | use bml_getters_m 14 | use bml_import_m 15 | use bml_init_m 16 | use bml_introspection_m 17 | use bml_inverse_m 18 | use bml_logger_m 19 | use bml_multiply_m 20 | use bml_norm_m 21 | use bml_normalize_m 22 | use bml_parallel_m 23 | use bml_scale_m 24 | use bml_setters_m 25 | use bml_shutdown_m 26 | use bml_submatrix_m 27 | use bml_threshold_m 28 | use bml_trace_m 29 | use bml_transpose_m 30 | use bml_transpose_triangle_m 31 | use bml_types_m 32 | use bml_utilities_m 33 | end module bml 34 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_transpose_m.F90: -------------------------------------------------------------------------------- 1 | !> Transpose functions. 2 | module bml_transpose_m 3 | 4 | use bml_c_interface_m 5 | use bml_types_m 6 | 7 | implicit none 8 | private 9 | 10 | public :: bml_transpose_new, bml_transpose 11 | 12 | contains 13 | 14 | !> Return the transpose of a matrix. 15 | !! 16 | !! @param a The matrix. 17 | !! @param a_t The transpose. 18 | subroutine bml_transpose_new(a, a_t) 19 | 20 | type(bml_matrix_t), intent(in) :: a 21 | type(bml_matrix_t), intent(inout) :: a_t 22 | 23 | call bml_deallocate(a_t) 24 | a_t%ptr = bml_transpose_new_C(a%ptr) 25 | 26 | end subroutine bml_transpose_new 27 | 28 | subroutine bml_transpose(a) 29 | 30 | type(bml_matrix_t), intent(in) :: a 31 | 32 | call bml_transpose_C(a%ptr) 33 | 34 | end subroutine bml_transpose 35 | 36 | end module bml_transpose_m 37 | -------------------------------------------------------------------------------- /Dockerfile-noble: -------------------------------------------------------------------------------- 1 | FROM ubuntu:noble 2 | LABEL org.opencontainers.image.authors="nicolasbock@gmail.com" 3 | 4 | RUN apt-get update 5 | RUN DEBIAN_FRONTEND=noninteractive apt-get install --yes sudo 6 | # RUN useradd --create-home --shell /bin/bash --user-group --groups sudo ubuntu 7 | # RUN sed --in-place --expression '/^%sudo/ s/ALL$/NOPASSWD: ALL/' /etc/sudoers 8 | 9 | COPY scripts/prepare-container-noble.sh /usr/sbin 10 | 11 | RUN /usr/sbin/prepare-container-noble.sh install_base 12 | RUN /usr/sbin/prepare-container-noble.sh configure_llvm 13 | RUN /usr/sbin/prepare-container-noble.sh configure_gcc 14 | RUN /usr/sbin/prepare-container-noble.sh set_timezone 15 | RUN /usr/sbin/prepare-container-noble.sh install_base_packages 16 | RUN /usr/sbin/prepare-container-noble.sh install_compilers 17 | RUN /usr/sbin/prepare-container-noble.sh install_linters 18 | 19 | WORKDIR /root 20 | -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_add_distributed2d.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_ADD_DISTRIBUTED2D_H 2 | #define __BML_ADD_DISTRIBUTED2D_H 3 | 4 | #include "bml_types_distributed2d.h" 5 | 6 | void bml_add_distributed2d( 7 | bml_matrix_distributed2d_t * A, 8 | bml_matrix_distributed2d_t * B, 9 | double alpha, 10 | double beta, 11 | double threshold); 12 | 13 | double bml_add_norm_distributed2d( 14 | bml_matrix_distributed2d_t * A, 15 | bml_matrix_distributed2d_t * B, 16 | double alpha, 17 | double beta, 18 | double threshold); 19 | 20 | void bml_scale_add_identity_distributed2d( 21 | bml_matrix_distributed2d_t * A, 22 | double alpha, 23 | double beta, 24 | double threshold); 25 | 26 | void bml_add_identity_distributed2d( 27 | bml_matrix_distributed2d_t * A, 28 | double beta, 29 | double threshold); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_export_distributed2d.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_EXPORT_DISTRIBUTED2D_H 2 | #define __BML_EXPORT_DISTRIBUTED2D_H 3 | 4 | #include "bml_types_distributed2d.h" 5 | 6 | void *bml_export_to_dense_distributed2d( 7 | bml_matrix_distributed2d_t * A, 8 | bml_dense_order_t order); 9 | 10 | void *bml_export_to_dense_distributed2d_single_real( 11 | bml_matrix_distributed2d_t * A, 12 | bml_dense_order_t order); 13 | 14 | void *bml_export_to_dense_distributed2d_double_real( 15 | bml_matrix_distributed2d_t * A, 16 | bml_dense_order_t order); 17 | 18 | void *bml_export_to_dense_distributed2d_single_complex( 19 | bml_matrix_distributed2d_t * A, 20 | bml_dense_order_t order); 21 | 22 | void *bml_export_to_dense_distributed2d_double_complex( 23 | bml_matrix_distributed2d_t * A, 24 | bml_dense_order_t order); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_diagonalize_m.F90: -------------------------------------------------------------------------------- 1 | !> Matrix diagonalization functions. 2 | module bml_diagonalize_m 3 | 4 | use bml_c_interface_m 5 | use bml_introspection_m 6 | use bml_types_m 7 | 8 | implicit none 9 | private 10 | 11 | public :: bml_diagonalize 12 | 13 | contains 14 | 15 | !> Diagonalize a matrix. 16 | !! 17 | !! @param a The matrix. 18 | !! @param eigenvalues The corresponding eigenvalues. 19 | !! @param eigenvectors The set of eigenvectors. 20 | subroutine bml_diagonalize(a, eigenvalues, eigenvectors) 21 | 22 | type(bml_matrix_t), intent(in) :: a 23 | real(C_DOUBLE), target, intent(inout) :: eigenvalues(*) 24 | type(bml_matrix_t), intent(inout) :: eigenvectors 25 | 26 | call bml_diagonalize_C(a%ptr, c_loc(eigenvalues), eigenvectors%ptr) 27 | 28 | end subroutine bml_diagonalize 29 | 30 | end module bml_diagonalize_m 31 | -------------------------------------------------------------------------------- /scripts/build_crusher_rocsparse_cce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure all the paths are correct 4 | 5 | rm -r build 6 | rm -r install 7 | 8 | MY_PATH=$(pwd) 9 | 10 | export CC=${CC:=cc} 11 | export FC=${FC:=ftn} 12 | export CXX=${CXX:=CC} 13 | export BLA_VENDOR=${BLA_VENDOR:=OpenBLAS} 14 | export BML_OMP_OFFLOAD=${BML_OMP_OFFLOAD:=yes} 15 | export BML_OFFLOAD_ARCH=${BML_OFFLOAD_ARCH:=AMD} 16 | export BML_ROCSPARSE=${BML_ROCSPARSE:=yes} 17 | export BML_COMPLEX=${BML_COMPLEX:=no} 18 | export BML_OPENMP=${BML_OPENMP:=yes} 19 | export BUILD_DIR=${BUILD_DIR:="${MY_PATH}/build"} 20 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 21 | export BML_TESTING=${BML_TESTING:=yes} 22 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 23 | export EXTRA_FFLAGS=${EXTRA_FFLAGS:=-hsystem_alloc} 24 | ./build.sh configure 25 | 26 | pushd ${BUILD_DIR} 27 | make -j16 28 | make install 29 | popd 30 | -------------------------------------------------------------------------------- /src/C-interface/csr/bml_diagonalize_csr.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_DIAGONALIZE_CSR_H 2 | #define __BML_DIAGONALIZE_CSR_H 3 | 4 | #include "bml_types_csr.h" 5 | 6 | void bml_diagonalize_csr( 7 | bml_matrix_csr_t * A, 8 | void *eigenvalues, 9 | bml_matrix_t * eigenvectors); 10 | 11 | void bml_diagonalize_csr_single_real( 12 | bml_matrix_csr_t * A, 13 | void *eigenvalues, 14 | bml_matrix_csr_t * eigenvectors); 15 | 16 | void bml_diagonalize_csr_double_real( 17 | bml_matrix_csr_t * A, 18 | void *eigenvalues, 19 | bml_matrix_csr_t * eigenvectors); 20 | 21 | void bml_diagonalize_csr_single_complex( 22 | bml_matrix_csr_t * A, 23 | void *eigenvalues, 24 | bml_matrix_csr_t * eigenvectors); 25 | 26 | void bml_diagonalize_csr_double_complex( 27 | bml_matrix_csr_t * A, 28 | void *eigenvalues, 29 | bml_matrix_csr_t * eigenvectors); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/C-interface/bml_multiply.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_MULTIPLY_H 4 | #define __BML_MULTIPLY_H 5 | 6 | #include "bml_types.h" 7 | 8 | // Multiply - C = alpha * A * B + beta * C 9 | void bml_multiply( 10 | bml_matrix_t * A, 11 | bml_matrix_t * B, 12 | bml_matrix_t * C, 13 | double alpha, 14 | double beta, 15 | double threshold); 16 | 17 | // Multiply X^2 - X2 = X * X 18 | void *bml_multiply_x2( 19 | bml_matrix_t * X, 20 | bml_matrix_t * X2, 21 | double threshold); 22 | 23 | // Multiply - C = A * B 24 | void bml_multiply_AB( 25 | bml_matrix_t * A, 26 | bml_matrix_t * B, 27 | bml_matrix_t * C, 28 | double threshold); 29 | 30 | // Multiply with threshold adjustment - C = A * B 31 | void bml_multiply_adjust_AB( 32 | bml_matrix_t * A, 33 | bml_matrix_t * B, 34 | bml_matrix_t * C, 35 | double threshold); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/C-interface/bml_shutdown.c: -------------------------------------------------------------------------------- 1 | #include "bml_shutdown.h" 2 | #include "bml_parallel.h" 3 | 4 | #ifdef BML_USE_MAGMA 5 | //define boolean data type needed by magma 6 | #include 7 | #include "magma_v2.h" 8 | #endif 9 | #ifdef BML_USE_XSMM 10 | #include "libxsmm.h" 11 | #endif 12 | 13 | #include 14 | 15 | /** Shutdown. 16 | * 17 | * \ingroup shutdown_group_C 18 | * 19 | */ 20 | void 21 | bml_shutdown( 22 | ) 23 | { 24 | bml_shutdownParallel(); 25 | #ifdef BML_USE_XSMM 26 | // De-initialize the library and free internal memory (optional) 27 | libxsmm_finalize(); 28 | #endif 29 | #ifdef BML_USE_MAGMA 30 | magma_finalize(); 31 | #endif 32 | } 33 | 34 | /** Shutdown from Fortran. 35 | * 36 | * \ingroup shutdown_group_C 37 | * 38 | */ 39 | void 40 | bml_shutdownF( 41 | ) 42 | { 43 | bml_shutdownParallelF(); 44 | // Future: shutdown GPUs, cublas, cusparse, etc. 45 | } 46 | -------------------------------------------------------------------------------- /Dockerfile-focal: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal 2 | LABEL org.opencontainers.image.authors="nicolasbock@gmail.com" 3 | 4 | RUN apt-get update 5 | RUN DEBIAN_FRONTEND=noninteractive apt-get install --yes sudo 6 | RUN useradd --create-home --shell /bin/bash --user-group --groups sudo ubuntu 7 | RUN sed --in-place --expression '/^%sudo/ s/ALL$/NOPASSWD: ALL/' /etc/sudoers 8 | 9 | COPY scripts/prepare-container-focal.sh /usr/sbin 10 | 11 | RUN /usr/sbin/prepare-container-focal.sh install_base 12 | RUN /usr/sbin/prepare-container-focal.sh configure_llvm 13 | RUN /usr/sbin/prepare-container-focal.sh configure_gcc 14 | RUN /usr/sbin/prepare-container-focal.sh configure_emacs 15 | RUN /usr/sbin/prepare-container-focal.sh set_timezone 16 | RUN /usr/sbin/prepare-container-focal.sh install_base_packages 17 | RUN /usr/sbin/prepare-container-focal.sh install_compilers 18 | RUN /usr/sbin/prepare-container-focal.sh install_linters 19 | 20 | WORKDIR /root 21 | -------------------------------------------------------------------------------- /Dockerfile-jammy: -------------------------------------------------------------------------------- 1 | FROM ubuntu:jammy 2 | LABEL org.opencontainers.image.authors="nicolasbock@gmail.com" 3 | 4 | RUN apt-get update 5 | RUN DEBIAN_FRONTEND=noninteractive apt-get install --yes sudo 6 | RUN useradd --create-home --shell /bin/bash --user-group --groups sudo ubuntu 7 | RUN sed --in-place --expression '/^%sudo/ s/ALL$/NOPASSWD: ALL/' /etc/sudoers 8 | 9 | COPY scripts/prepare-container-jammy.sh /usr/sbin 10 | 11 | RUN /usr/sbin/prepare-container-jammy.sh install_base 12 | RUN /usr/sbin/prepare-container-jammy.sh configure_llvm 13 | RUN /usr/sbin/prepare-container-jammy.sh configure_gcc 14 | RUN /usr/sbin/prepare-container-jammy.sh configure_emacs 15 | RUN /usr/sbin/prepare-container-jammy.sh set_timezone 16 | RUN /usr/sbin/prepare-container-jammy.sh install_base_packages 17 | RUN /usr/sbin/prepare-container-jammy.sh install_compilers 18 | RUN /usr/sbin/prepare-container-jammy.sh install_linters 19 | 20 | WORKDIR /root 21 | -------------------------------------------------------------------------------- /src/C-interface/dense/bml_diagonalize_dense.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_DIAGONALIZE_DENSE_H 2 | #define __BML_DIAGONALIZE_DENSE_H 3 | 4 | #include "bml_types_dense.h" 5 | 6 | void bml_diagonalize_dense( 7 | bml_matrix_dense_t * A, 8 | void *eigenvalues, 9 | bml_matrix_t * eigenvectors); 10 | 11 | void bml_diagonalize_dense_single_real( 12 | bml_matrix_dense_t * A, 13 | void *eigenvalues, 14 | bml_matrix_dense_t * eigenvectors); 15 | 16 | void bml_diagonalize_dense_double_real( 17 | bml_matrix_dense_t * A, 18 | void *eigenvalues, 19 | bml_matrix_dense_t * eigenvectors); 20 | 21 | void bml_diagonalize_dense_single_complex( 22 | bml_matrix_dense_t * A, 23 | void *eigenvalues, 24 | bml_matrix_dense_t * eigenvectors); 25 | 26 | void bml_diagonalize_dense_double_complex( 27 | bml_matrix_dense_t * A, 28 | void *eigenvalues, 29 | bml_matrix_dense_t * eigenvectors); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /test-getter/ptr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int 6 | main( 7 | int argc, 8 | char **argv) 9 | { 10 | bml_matrix_t *A; 11 | float *diagonal; 12 | float *row; 13 | float *Aij; 14 | 15 | A = bml_random_matrix(ellpack, single_real, 10, 10, sequential); 16 | //A = bml_identity_matrix(ellpack, single_real, 10, 10, sequential); 17 | diagonal = bml_get_diagonal(A); 18 | row = bml_get_row(A, 0); 19 | Aij = bml_get(A, 0, 0); 20 | 21 | bml_print_bml_matrix(A, 0, 10, 0, 10); 22 | 23 | printf("diagonal:\n"); 24 | for (int i = 0; i < 10; i++) 25 | { 26 | printf("%f\n", diagonal[i]); 27 | } 28 | free(diagonal); 29 | 30 | printf("row[0]\n"); 31 | for (int i = 0; i < 10; i++) 32 | { 33 | printf("%f\n", row[i]); 34 | } 35 | free(row); 36 | 37 | printf("A[0][0] = %f\n", *Aij); 38 | 39 | bml_deallocate(&A); 40 | } 41 | -------------------------------------------------------------------------------- /scripts/build_crusher_magma_cce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure all the paths are correct 4 | 5 | rm -r build 6 | rm -r install 7 | 8 | MY_PATH=$(pwd) 9 | 10 | export CC=${CC:=cc} 11 | export FC=${FC:=ftn} 12 | export CXX=${CXX:=CC} 13 | 14 | export BLAS_VENDOR=${BLAS_VENDOR:=OpenBLAS} 15 | 16 | export BML_OPENMP=${BML_OPENMP:=yes} 17 | 18 | export BML_MAGMA=${BML_MAGMA:=yes} 19 | export MAGMA_ROOT=${OLCF_MAGMA_ROOT} 20 | export BML_ROCSOLVER=${BML_ROCSOLVER:=no} 21 | export BML_TESTING=${BML_TESTING:=yes} 22 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 23 | export INSTALL_DIR="/autofs/nccs-svm1_proj/csc304/bml/crusher/cce" 24 | export EXTRA_FFLAGS=${EXTRA_FCFLAGS:="-hsystem_alloc"} 25 | 26 | export BML_NONMPI_PRECOMMAND=${BML_NONMPI_PRECOMMAND:="srun"} 27 | export BML_NONMPI_PRECOMMAND_ARGS=${BML_NONMPI_PRECOMMAND_ARGS:="-n1;-c4;--gpus=1"} 28 | 29 | ./build.sh configure 30 | 31 | pushd build 32 | make -j8 33 | make install 34 | popd 35 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.https://www.sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /scripts/build_tulip_offload_cce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure all the paths are correct 4 | 5 | rm -r build 6 | rm -r install 7 | 8 | MY_PATH=$(pwd) 9 | 10 | export CC=${CC:=cc} 11 | export FC=${FC:=ftn} 12 | export CXX=${CXX:=CC} 13 | export BLAS_VENDOR=${BLAS_VENDOR:=Auto} 14 | export BML_OPENMP=${BML_OPENMP:=yes} 15 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 16 | export BML_MAGMA=${BML_MAGMA:=yes} 17 | export MAGMA_ROOT=${MAGMA_HOME} 18 | export BML_TESTING=${BML_TESTING:=yes} 19 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 20 | export CMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS:="-ef -DCRAY_SDK"} 21 | #export EXTRA_CFLAGS=${EXTRA_CFLAGS:="-Ofast -DUSE_OMP_OFFLOAD -DCRAY_SDK"} 22 | export CMAKE_C_FLAGS=${CMAKE_C_FLAGS:="-Ofast -DUSE_OMP_OFFLOAD -DCRAY_SDK"} 23 | export EXTRA_LINK_FLAGS=${EXTRA_LINK_FLAGS:="-L${BLASDIR} -l${BLASLIB}"} 24 | 25 | ./build.sh configure 26 | 27 | pushd build 28 | make -j8 29 | make install 30 | popd 31 | -------------------------------------------------------------------------------- /src/C-interface/ellpack/bml_diagonalize_ellpack.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_DIAGONALIZE_ELLPACK_H 2 | #define __BML_DIAGONALIZE_ELLPACK_H 3 | 4 | #include "bml_types_ellpack.h" 5 | 6 | void bml_diagonalize_ellpack( 7 | bml_matrix_ellpack_t * A, 8 | void *eigenvalues, 9 | bml_matrix_t * eigenvectors); 10 | 11 | void bml_diagonalize_ellpack_single_real( 12 | bml_matrix_ellpack_t * A, 13 | void *eigenvalues, 14 | bml_matrix_ellpack_t * eigenvectors); 15 | 16 | void bml_diagonalize_ellpack_double_real( 17 | bml_matrix_ellpack_t * A, 18 | void *eigenvalues, 19 | bml_matrix_ellpack_t * eigenvectors); 20 | 21 | void bml_diagonalize_ellpack_single_complex( 22 | bml_matrix_ellpack_t * A, 23 | void *eigenvalues, 24 | bml_matrix_ellpack_t * eigenvectors); 25 | 26 | void bml_diagonalize_ellpack_double_complex( 27 | bml_matrix_ellpack_t * A, 28 | void *eigenvalues, 29 | bml_matrix_ellpack_t * eigenvectors); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /docs/API/bml__submatrix_8h.js: -------------------------------------------------------------------------------- 1 | var bml__submatrix_8h = 2 | [ 3 | [ "bml_adjacency", "bml__submatrix_8h.html#a77fef8e0e8749b499f979e356df0f03e", null ], 4 | [ "bml_adjacency_group", "bml__submatrix_8h.html#a5fb3d87427a5449d7fd39bad9034b075", null ], 5 | [ "bml_assign_submatrix", "bml__submatrix_8h.html#a187a453d4e0aa0c348cb359083394b4f", null ], 6 | [ "bml_extract_submatrix", "bml__submatrix_8h.html#abd36e233c4b3b247d929617bbf6a0189", null ], 7 | [ "bml_group_matrix", "bml__submatrix_8h.html#af54e52c53f85579791ffa25d8ccf0b94", null ], 8 | [ "bml_matrix2submatrix", "bml__submatrix_8h.html#a331b7ab46bcffcabfdaef4d9dfdd378b", null ], 9 | [ "bml_matrix2submatrix_index", "bml__submatrix_8h.html#aed513cf5f070925d10cd6fbaa07f0c1c", null ], 10 | [ "bml_matrix2submatrix_index_graph", "bml__submatrix_8h.html#a1e3f458b2031d1783dd93c89cf0200ea", null ], 11 | [ "bml_submatrix2matrix", "bml__submatrix_8h.html#adc606505575f2681b5db802021fe6a60", null ] 12 | ]; -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_getters_distributed2d.c: -------------------------------------------------------------------------------- 1 | #include "../bml_logger.h" 2 | #include "bml_getters_distributed2d.h" 3 | 4 | void * 5 | bml_get_row_distributed2d( 6 | bml_matrix_distributed2d_t * A, 7 | int i) 8 | { 9 | switch (A->matrix_precision) 10 | { 11 | case single_real: 12 | return bml_get_row_distributed2d_single_real(A, i); 13 | break; 14 | case double_real: 15 | return bml_get_row_distributed2d_double_real(A, i); 16 | break; 17 | #ifdef BML_COMPLEX 18 | case single_complex: 19 | return bml_get_row_distributed2d_single_complex(A, i); 20 | break; 21 | case double_complex: 22 | return bml_get_row_distributed2d_double_complex(A, i); 23 | break; 24 | #endif 25 | default: 26 | LOG_ERROR("unkonwn precision in bml_get_row_distributed2d\n"); 27 | break; 28 | } 29 | return NULL; 30 | } 31 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_parallel_m.F90: -------------------------------------------------------------------------------- 1 | !> MPI parallel communication. 2 | module bml_parallel_m 3 | 4 | use bml_c_interface_m 5 | use bml_types_m 6 | 7 | implicit none 8 | private 9 | 10 | public :: bml_allGatherVParallel 11 | public :: bml_getNRanks 12 | public :: bml_getMyRank 13 | 14 | contains 15 | 16 | !> Multiply two matrices. 17 | !! 18 | !! 19 | !! \param a Matrix to be distributed. 20 | subroutine bml_allGatherVParallel(a) 21 | 22 | type(bml_matrix_t), intent(inout) :: a 23 | 24 | call bml_allGatherVParallel_C(a%ptr) 25 | 26 | end subroutine bml_allGatherVParallel 27 | 28 | function bml_getNRanks() 29 | 30 | integer :: bml_getNRanks 31 | 32 | bml_getNRanks = bml_getNRanks_C() 33 | 34 | end function bml_getNRanks 35 | 36 | function bml_getMyRank() 37 | 38 | integer :: bml_getMyRank 39 | 40 | bml_getMyRank = bml_getMyRank_C() 41 | 42 | end function bml_getMyRank 43 | 44 | end module bml_parallel_m 45 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 22] 27 | 28 | **Smartphone (please complete the following information):** 29 | - Device: [e.g. iPhone6] 30 | - OS: [e.g. iOS8.1] 31 | - Browser [e.g. stock browser, safari] 32 | - Version [e.g. 22] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_norm_distributed2d.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_NORM_DISTRIBUTED2D_H 2 | #define __BML_NORM_DISTRIBUTED2D_H 3 | 4 | #include "bml_types_distributed2d.h" 5 | 6 | double bml_sum_squares_distributed2d( 7 | bml_matrix_distributed2d_t * A); 8 | 9 | double bml_sum_squares_submatrix_distributed2d( 10 | bml_matrix_distributed2d_t * A, 11 | int core_size); 12 | 13 | double bml_sum_AB_distributed2d( 14 | bml_matrix_distributed2d_t * A, 15 | bml_matrix_distributed2d_t * B, 16 | double alpha, 17 | double threshold); 18 | 19 | double bml_sum_squares2_distributed2d( 20 | bml_matrix_distributed2d_t * A, 21 | bml_matrix_distributed2d_t * B, 22 | double alpha, 23 | double beta, 24 | double threshold); 25 | 26 | double bml_fnorm_distributed2d( 27 | bml_matrix_distributed2d_t * A); 28 | 29 | double bml_fnorm2_distributed2d( 30 | bml_matrix_distributed2d_t * A, 31 | bml_matrix_distributed2d_t * B); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/C-interface/ellblock/bml_diagonalize_ellblock.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_DIAGONALIZE_BELLBLOCK_H 2 | #define __BML_DIAGONALIZE_BELLBLOCK_H 3 | 4 | #include "bml_types_ellblock.h" 5 | 6 | void bml_diagonalize_ellblock( 7 | bml_matrix_ellblock_t * A, 8 | void *eigenvalues, 9 | bml_matrix_t * eigenvectors); 10 | 11 | void bml_diagonalize_ellblock_single_real( 12 | bml_matrix_ellblock_t * A, 13 | void *eigenvalues, 14 | bml_matrix_ellblock_t * eigenvectors); 15 | 16 | void bml_diagonalize_ellblock_double_real( 17 | bml_matrix_ellblock_t * A, 18 | void *eigenvalues, 19 | bml_matrix_ellblock_t * eigenvectors); 20 | 21 | void bml_diagonalize_ellblock_single_complex( 22 | bml_matrix_ellblock_t * A, 23 | void *eigenvalues, 24 | bml_matrix_ellblock_t * eigenvectors); 25 | 26 | void bml_diagonalize_ellblock_double_complex( 27 | bml_matrix_ellblock_t * A, 28 | void *eigenvalues, 29 | bml_matrix_ellblock_t * eigenvectors); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /scripts/build_iris_offload_oneapi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure all the paths are correct 4 | 5 | if [ -e build ];then 6 | rm -r build 7 | fi 8 | 9 | if [ -e install ];then 10 | rm -r install 11 | fi 12 | 13 | MY_PATH=$(pwd) 14 | 15 | export CC=icx 16 | export FC=ifx 17 | export CXX=icpx 18 | 19 | export BLAS_VENDOR=${BLAS_VENDOR:=MKL} 20 | export BML_OPENMP=${BML_OPENMP:=yes} 21 | export BML_GPU=${BML_GPU:=no} 22 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 23 | export BML_TESTING=${BML_TESTING:=yes} 24 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 25 | export EXTRA_CFLAGS=${EXTRA_CFLAGS:=""} 26 | export EXTRA_LINK_FLAGS=${EXTRA_LINK_FLAGS:=""} 27 | export CMAKE_Fortran_FLAGS="-fopenmp-targets=spir64 -DINTEL_SDK -fiopenmp" 28 | export CMAKE_C_FLAGS="-fopenmp-targets=spir64 -DINTEL_SDK -D__STRICT_ANSI__ -DUSE_OMP_OFFLOAD -fiopenmp -Wno-missing-prototype-for-cc" 29 | 30 | ./build.sh configure 31 | 32 | pushd build 33 | make -j8 34 | make install 35 | popd 36 | -------------------------------------------------------------------------------- /src/C-interface/bml_introspection.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_INTROSPECTION_H 4 | #define __BML_INTROSPECTION_H 5 | 6 | #include "bml_types.h" 7 | 8 | bml_matrix_type_t bml_get_type( 9 | bml_matrix_t * A); 10 | 11 | bml_matrix_type_t bml_get_deep_type( 12 | bml_matrix_t * A); 13 | 14 | bml_matrix_precision_t bml_get_precision( 15 | bml_matrix_t * A); 16 | 17 | int bml_get_N( 18 | bml_matrix_t * A); 19 | 20 | int bml_get_M( 21 | bml_matrix_t * A); 22 | 23 | int bml_get_NB( 24 | bml_matrix_t * A); 25 | 26 | int bml_get_row_bandwidth( 27 | bml_matrix_t * A, 28 | int i); 29 | 30 | int bml_get_bandwidth( 31 | bml_matrix_t * A); 32 | 33 | double bml_get_sparsity( 34 | bml_matrix_t * A, 35 | double threshold); 36 | 37 | bml_distribution_mode_t bml_get_distribution_mode( 38 | bml_matrix_t * A); 39 | 40 | bml_matrix_t *bml_get_local_matrix( 41 | bml_matrix_t * A); 42 | 43 | void *bml_get_data_ptr( 44 | bml_matrix_t * A); 45 | #endif 46 | -------------------------------------------------------------------------------- /src/C-interface/bml_inverse.c: -------------------------------------------------------------------------------- 1 | #include "bml_inverse.h" 2 | #include "bml_introspection.h" 3 | #include "bml_utilities.h" 4 | #include "bml_logger.h" 5 | #include "bml_types.h" 6 | #include "dense/bml_inverse_dense.h" 7 | #include "ellpack/bml_inverse_ellpack.h" 8 | #include "ellblock/bml_inverse_ellblock.h" 9 | #include "csr/bml_inverse_csr.h" 10 | 11 | bml_matrix_t * 12 | bml_inverse( 13 | bml_matrix_t * A) 14 | { 15 | bml_matrix_t *B = NULL; 16 | 17 | switch (bml_get_type(A)) 18 | { 19 | case dense: 20 | B = bml_inverse_dense(A); 21 | break; 22 | case ellpack: 23 | B = bml_inverse_ellpack(A); 24 | break; 25 | case ellblock: 26 | B = bml_inverse_ellblock(A); 27 | break; 28 | case csr: 29 | B = bml_inverse_csr(A); 30 | break; 31 | default: 32 | LOG_ERROR("unknown matrix type\n"); 33 | break; 34 | } 35 | 36 | return B; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/C-interface/dense/bml_element_multiply_dense.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_ELEMNET_MULTIPLY_DENSE_H 2 | #define __BML_ELEMNET_MULTIPLY_DENSE_H 3 | 4 | #include "bml_types_dense.h" 5 | 6 | // Element-wise Matrix multiply (Hadamard product) 7 | void bml_element_multiply_AB_dense( 8 | bml_matrix_dense_t * A, 9 | bml_matrix_dense_t * B, 10 | bml_matrix_dense_t * C); 11 | 12 | void bml_element_multiply_AB_dense_single_real( 13 | bml_matrix_dense_t * A, 14 | bml_matrix_dense_t * B, 15 | bml_matrix_dense_t * C); 16 | 17 | void bml_element_multiply_AB_dense_double_real( 18 | bml_matrix_dense_t * A, 19 | bml_matrix_dense_t * B, 20 | bml_matrix_dense_t * C); 21 | 22 | void bml_element_multiply_AB_dense_single_complex( 23 | bml_matrix_dense_t * A, 24 | bml_matrix_dense_t * B, 25 | bml_matrix_dense_t * C); 26 | 27 | void bml_element_multiply_AB_dense_double_complex( 28 | bml_matrix_dense_t * A, 29 | bml_matrix_dense_t * B, 30 | bml_matrix_dense_t * C); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_trace_m.F90: -------------------------------------------------------------------------------- 1 | !> Matrix trace. 2 | module bml_trace_m 3 | 4 | use bml_c_interface_m 5 | use bml_types_m 6 | 7 | implicit none 8 | private 9 | 10 | public :: bml_trace 11 | public :: bml_trace_mult 12 | 13 | contains 14 | 15 | !> Calculate the trace of a matrix. 16 | !! 17 | !! \f$ \leftarrow \mathrm{Tr} \left[ A \right] \f$ 18 | !! 19 | !! \param a The matrix. 20 | function bml_trace(a) result(tr_a) 21 | 22 | class(bml_matrix_t), intent(in) :: a 23 | real(C_DOUBLE) :: tr_a 24 | 25 | tr_a = bml_trace_C(a%ptr) 26 | 27 | end function bml_trace 28 | 29 | !> Calculate the trace of a matrix multiplication. 30 | !! 31 | !! \param a The matrix a. 32 | !! \param b The matrix b. 33 | function bml_trace_mult(a, b) result(tr_mult) 34 | 35 | class(bml_matrix_t), intent(in) :: a, b 36 | real(C_DOUBLE) :: tr_mult 37 | 38 | tr_mult= bml_trace_mult_C(a%ptr, b%ptr) 39 | 40 | end function bml_trace_mult 41 | 42 | end module bml_trace_m 43 | -------------------------------------------------------------------------------- /tests/C-tests/add_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __ADD_MATRIX_H 2 | #define __ADD_MATRIX_H 3 | 4 | #include 5 | 6 | int test_add( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_add_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_add_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_add_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_add_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/C-interface/bml_transpose_triangle.c: -------------------------------------------------------------------------------- 1 | #include "bml_transpose_triangle.h" 2 | #include "bml_introspection.h" 3 | #include "bml_logger.h" 4 | #include "dense/bml_transpose_triangle_dense.h" 5 | 6 | #include 7 | 8 | /** Transposes a triangle of a matrix in place. 9 | * 10 | * \ingroup transpose_triangle_group 11 | * 12 | * \param A The matrix for which the triangle should be transposed 13 | * \param triangle Which triangle to transpose ('u': upper, 'l': lower) 14 | */ 15 | void 16 | bml_transpose_triangle( 17 | bml_matrix_t * A, 18 | char triangle) 19 | { 20 | switch (bml_get_type(A)) 21 | { 22 | case dense: 23 | bml_transpose_triangle_dense(A, triangle); 24 | break; 25 | /* 26 | case ellpack: 27 | bml_transpose_triangle_ellpack(A, triangle); 28 | break; 29 | */ 30 | default: 31 | LOG_ERROR("unknown matrix type\n"); 32 | break; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/C-interface/bml_init.c: -------------------------------------------------------------------------------- 1 | #include "bml_init.h" 2 | #include "bml_parallel.h" 3 | 4 | #ifdef BML_USE_MAGMA 5 | //define boolean data type needed by magma 6 | #include 7 | #include "magma_v2.h" 8 | #endif 9 | #ifdef BML_USE_XSMM 10 | #include "libxsmm.h" 11 | #endif 12 | 13 | #include 14 | 15 | /** Initialize. 16 | * 17 | * \ingroup init_group_C 18 | * 19 | * \param argc Number of args 20 | * \param argv Args 21 | */ 22 | void 23 | bml_init( 24 | #ifdef BML_USE_MPI 25 | MPI_Comm comm 26 | #endif 27 | ) 28 | { 29 | #ifdef BML_USE_MAGMA 30 | magma_init(); 31 | #endif 32 | #ifdef BML_USE_XSMM 33 | // Initialize the library; pay for setup cost here 34 | libxsmm_init(); 35 | #endif 36 | #ifdef BML_USE_MPI 37 | bml_initParallel(comm); 38 | #endif 39 | } 40 | 41 | /** Initialize from Fortran. 42 | * 43 | * \ingroup init_group_C 44 | * 45 | * \param Comm from Fortran 46 | */ 47 | void 48 | bml_initF( 49 | int fcomm) 50 | { 51 | bml_initParallelF(fcomm); 52 | } 53 | -------------------------------------------------------------------------------- /tests/C-tests/copy_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __COPY_MATRIX_H 2 | #define __COPY_MATRIX_H 3 | 4 | #include 5 | 6 | int test_copy( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_copy_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_copy_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_copy_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_copy_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/norm_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __NORM_MATRIX_H 2 | #define __NORM_MATRIX_H 3 | 4 | #include 5 | 6 | int test_norm( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_norm_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_norm_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_norm_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_norm_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/C-interface/bml_utilities.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_UTILITIES_H 4 | #define __BML_UTILITIES_H 5 | 6 | #include "bml_types.h" 7 | #define PRINT_THRESHOLD 16 8 | 9 | void bml_print_dense_matrix( 10 | int N, 11 | bml_matrix_precision_t matrix_precision, 12 | bml_dense_order_t order, 13 | void *A, 14 | int i_l, 15 | int i_u, 16 | int j_l, 17 | int j_u); 18 | 19 | void bml_print_dense_vector( 20 | int N, 21 | bml_matrix_precision_t matrix_precision, 22 | void *v, 23 | int i_l, 24 | int i_u); 25 | 26 | void bml_print_bml_vector( 27 | bml_vector_t * v, 28 | int i_l, 29 | int i_u); 30 | 31 | void bml_print_bml_matrix( 32 | bml_matrix_t * A, 33 | int i_l, 34 | int i_u, 35 | int j_l, 36 | int j_u); 37 | 38 | void bml_read_bml_matrix( 39 | bml_matrix_t * A, 40 | char *filename); 41 | 42 | void bml_write_bml_matrix( 43 | bml_matrix_t * A, 44 | char *filename); 45 | 46 | int bml_sqrtint( 47 | const int x); 48 | #endif 49 | -------------------------------------------------------------------------------- /src/C-interface/ellpack/bml_convert_ellpack_typed.c: -------------------------------------------------------------------------------- 1 | #include "../../macros.h" 2 | #include "../../typed.h" 3 | #include "../bml_getters.h" 4 | #include "../bml_introspection.h" 5 | #include "../bml_logger.h" 6 | #include "../bml_setters.h" 7 | #include "bml_allocate_ellpack.h" 8 | #include "bml_types_ellpack.h" 9 | 10 | #include 11 | 12 | bml_matrix_ellpack_t *TYPED_FUNC( 13 | bml_convert_ellpack) ( 14 | bml_matrix_t * A, 15 | bml_matrix_precision_t matrix_precision, 16 | int M, 17 | bml_distribution_mode_t distrib_mode) 18 | { 19 | int N = bml_get_N(A); 20 | 21 | if (N < 0) 22 | { 23 | LOG_ERROR("A is not intialized\n"); 24 | } 25 | 26 | bml_matrix_ellpack_t *B = 27 | bml_zero_matrix_ellpack(matrix_precision, N, M, distrib_mode); 28 | 29 | for (int i = 0; i < N; i++) 30 | { 31 | for (int j = 0; j < N; j++) 32 | { 33 | bml_set_element(B, i, j, bml_get_element(A, i, j)); 34 | } 35 | } 36 | 37 | return B; 38 | } 39 | -------------------------------------------------------------------------------- /tests/C-tests/print_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __PRINT_MATRIX_H 2 | #define __PRINT_MATRIX_H 3 | 4 | #include 5 | 6 | int test_print( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_print_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_print_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_print_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_print_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/scale_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __SCALE_MATRIX_H 2 | #define __SCALE_MATRIX_H 3 | 4 | #include 5 | 6 | int test_scale( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_scale_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_scale_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_scale_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_scale_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/trace_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __TRACE_MATRIX_H 2 | #define __TRACE_MATRIX_H 3 | 4 | #include 5 | 6 | int test_trace( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_trace_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_trace_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_trace_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_trace_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/set_row.h: -------------------------------------------------------------------------------- 1 | #ifndef __SET_ROW_MATRIX_H 2 | #define __SET_ROW_MATRIX_H 3 | 4 | #include 5 | 6 | int test_set_row( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_set_row_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_set_row_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_set_row_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_set_row_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/C-interface/csr/bml_element_multiply_csr.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_ELEMNET_MULTIPLY_CSR_H 2 | #define __BML_ELEMNET_MULTIPLY_CSR_H 3 | 4 | #include "bml_types_csr.h" 5 | 6 | void bml_element_multiply_AB_csr( 7 | bml_matrix_csr_t * A, 8 | bml_matrix_csr_t * B, 9 | bml_matrix_csr_t * C, 10 | double threshold); 11 | 12 | void bml_element_multiply_AB_csr_single_real( 13 | bml_matrix_csr_t * A, 14 | bml_matrix_csr_t * B, 15 | bml_matrix_csr_t * C, 16 | double threshold); 17 | 18 | void bml_element_multiply_AB_csr_double_real( 19 | bml_matrix_csr_t * A, 20 | bml_matrix_csr_t * B, 21 | bml_matrix_csr_t * C, 22 | double threshold); 23 | 24 | void bml_element_multiply_AB_csr_single_complex( 25 | bml_matrix_csr_t * A, 26 | bml_matrix_csr_t * B, 27 | bml_matrix_csr_t * C, 28 | double threshold); 29 | 30 | void bml_element_multiply_AB_csr_double_complex( 31 | bml_matrix_csr_t * A, 32 | bml_matrix_csr_t * B, 33 | bml_matrix_csr_t * C, 34 | double threshold); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/bml_gemm.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_BML_GEMM_H 2 | #define __TEST_BML_GEMM_H 3 | 4 | #include 5 | 6 | int test_bml_gemm( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_bml_gemm_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_bml_gemm_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_bml_gemm_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_bml_gemm_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/adjacency_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __ADJACENCY_H 2 | #define __ADJACENCY_H 3 | 4 | #include 5 | 6 | int test_adjacency( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_adjacency_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_adjacency_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_adjacency_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_adjacency_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/convert_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONVERT_MATRIX_H 2 | #define __CONVERT_MATRIX_H 3 | 4 | #include 5 | 6 | int test_convert( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_convert_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_convert_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_convert_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_convert_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/inverse_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __INVERSE_MATRIX_H 2 | #define __INVERSE_MATRIX_H 3 | 4 | #include 5 | 6 | int test_inverse( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_inverse_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_inverse_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_inverse_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_inverse_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/test_template.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_TEMPLATE_H 2 | #define __TEST_TEMPLATE_H 3 | 4 | #include 5 | 6 | int test_template( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_template_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_template_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_template_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_template_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/C-interface/dense/bml_inverse_dense.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_INVERSE_DENSE_H 2 | #define __BML_INVERSE_DENSE_H 3 | 4 | #include "bml_types_dense.h" 5 | 6 | bml_matrix_dense_t *bml_inverse_dense( 7 | bml_matrix_dense_t * A); 8 | 9 | bml_matrix_dense_t *bml_inverse_dense_single_real( 10 | bml_matrix_dense_t * A); 11 | 12 | bml_matrix_dense_t *bml_inverse_dense_double_real( 13 | bml_matrix_dense_t * A); 14 | 15 | bml_matrix_dense_t *bml_inverse_dense_single_complex( 16 | bml_matrix_dense_t * A); 17 | 18 | bml_matrix_dense_t *bml_inverse_dense_double_complex( 19 | bml_matrix_dense_t * A); 20 | 21 | void bml_inverse_inplace_dense( 22 | bml_matrix_dense_t * A); 23 | 24 | void bml_inverse_inplace_dense_single_real( 25 | bml_matrix_dense_t * A); 26 | 27 | void bml_inverse_inplace_dense_double_real( 28 | bml_matrix_dense_t * A); 29 | 30 | void bml_inverse_inplace_dense_single_complex( 31 | bml_matrix_dense_t * A); 32 | 33 | void bml_inverse_inplace_dense_double_complex( 34 | bml_matrix_dense_t * A); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/allocate_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __ALLOCATE_MATRIX_H 2 | #define __ALLOCATE_MATRIX_H 3 | 4 | #include 5 | 6 | int test_allocate( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_allocate_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_allocate_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_allocate_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_allocate_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/io_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_IO_MATRIX_H 2 | #define __TEST_IO_MATRIX_H 3 | 4 | #include 5 | 6 | int test_io_matrix( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_io_matrix_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_io_matrix_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_io_matrix_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_io_matrix_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/multiply_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __MULTIPLY_MATRIX_H 2 | #define __MULTIPLY_MATRIX_H 3 | 4 | #include 5 | 6 | int test_multiply( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_multiply_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_multiply_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_multiply_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_multiply_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/get_element.h: -------------------------------------------------------------------------------- 1 | #ifndef __GET_ELEMENT_H 2 | #define __GET_ELEMENT_H 3 | 4 | #include 5 | 6 | int test_get_element( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_get_element_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_get_element_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_get_element_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_get_element_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/set_element.h: -------------------------------------------------------------------------------- 1 | #ifndef __SET_ELEMENT_H 2 | #define __SET_ELEMENT_H 3 | 4 | #include 5 | 6 | int test_set_element( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_set_element_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_set_element_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_set_element_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_set_element_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/trace_mult.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_TRACE_MULT_H 2 | #define __TEST_TRACE_MULT_H 3 | 4 | #include 5 | 6 | int test_trace_mult( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_trace_mult_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_trace_mult_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_trace_mult_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_trace_mult_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/C-interface/csr/bml_inverse_csr.c: -------------------------------------------------------------------------------- 1 | #include "../bml_logger.h" 2 | #include "../bml_types.h" 3 | #include "bml_inverse_csr.h" 4 | #include "bml_types_csr.h" 5 | #include "../bml_utilities.h" 6 | 7 | #include 8 | 9 | /** \page inverse 10 | * 11 | */ 12 | 13 | bml_matrix_csr_t * 14 | bml_inverse_csr( 15 | bml_matrix_csr_t * A) 16 | { 17 | 18 | bml_matrix_csr_t *B = NULL; 19 | 20 | switch (A->matrix_precision) 21 | { 22 | case single_real: 23 | B = bml_inverse_csr_single_real(A); 24 | break; 25 | case double_real: 26 | B = bml_inverse_csr_double_real(A); 27 | break; 28 | #ifdef BML_COMPLEX 29 | case single_complex: 30 | B = bml_inverse_csr_single_complex(A); 31 | break; 32 | case double_complex: 33 | B = bml_inverse_csr_double_complex(A); 34 | break; 35 | #endif 36 | default: 37 | LOG_ERROR("unknown precision\n"); 38 | break; 39 | } 40 | 41 | return B; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/C-interface/dense/bml_transpose_dense.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_TRANSPOSE_DENSE_H 2 | #define __BML_TRANSPOSE_DENSE_H 3 | 4 | #include "bml_types_dense.h" 5 | 6 | bml_matrix_dense_t *bml_transpose_new_dense( 7 | bml_matrix_dense_t * A); 8 | 9 | bml_matrix_dense_t *bml_transpose_new_dense_single_real( 10 | bml_matrix_dense_t * A); 11 | 12 | bml_matrix_dense_t *bml_transpose_new_dense_double_real( 13 | bml_matrix_dense_t * A); 14 | 15 | bml_matrix_dense_t *bml_transpose_new_dense_single_complex( 16 | bml_matrix_dense_t * A); 17 | 18 | bml_matrix_dense_t *bml_transpose_new_dense_double_complex( 19 | bml_matrix_dense_t * A); 20 | 21 | void bml_transpose_dense( 22 | bml_matrix_dense_t * A); 23 | 24 | void bml_transpose_dense_single_real( 25 | bml_matrix_dense_t * A); 26 | 27 | void bml_transpose_dense_double_real( 28 | bml_matrix_dense_t * A); 29 | 30 | void bml_transpose_dense_single_complex( 31 | bml_matrix_dense_t * A); 32 | 33 | void bml_transpose_dense_double_complex( 34 | bml_matrix_dense_t * A); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/normalize_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __NORMALIZE_MATRIX_H 2 | #define __NORMALIZE_MATRIX_H 3 | 4 | #include 5 | 6 | int test_normalize( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_normalize_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_normalize_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_normalize_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_normalize_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/submatrix_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __SUBMATRIX_MATRIX_H 2 | #define __SUBMATRIX_MATRIX_H 3 | 4 | #include 5 | 6 | int test_submatrix( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_submatrix_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_submatrix_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_submatrix_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_submatrix_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/threshold_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __THRESHOLD_MATRIX_H 2 | #define __THRESHOLD_MATRIX_H 3 | 4 | #include 5 | 6 | int test_threshold( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_threshold_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_threshold_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_threshold_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_threshold_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/transpose_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __TRANSPOSE_MATRIX_H 2 | #define __TRANSPOSE_MATRIX_H 3 | 4 | #include 5 | 6 | int test_transpose( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_transpose_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_transpose_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_transpose_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_transpose_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/introspection.h: -------------------------------------------------------------------------------- 1 | #ifndef __INTROSPECTION_H 2 | #define __INTROSPECTION_H 3 | 4 | #include 5 | 6 | int test_introspection( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_introspection_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_introspection_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_introspection_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_introspection_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /examples/example1/Makefile: -------------------------------------------------------------------------------- 1 | BML_DIR=$(HOME)/bml/install 2 | F90 = gfortran 3 | F90FLAGS += -fopenmp -I/$(BML_DIR)/include -L/$(BML_DIR)/lib/ -lbml 4 | LIBS+= -Wl,--no-as-needed -L${MKLROOT}/lib/intel64 -lmkl_gf_lp64 -lmkl_core -lmkl_gnu_thread -ldl -lpthread -lm -fopenmp 5 | LIBS+= -L/$(BML_DIR)/lib/ -lbml 6 | 7 | # how to produce objects from source files 8 | 9 | %.o:%.f90 10 | $(F90) $(F90FLAGS) -c $< 11 | 12 | %.o:%.f95 13 | $(F90) $(F90FLAGS) -c $< 14 | 15 | %.o:%.f 16 | $(F77) $(F77FLAGS) -c $< 17 | 18 | # General vars 19 | 20 | TARGET = ./main 21 | 22 | all: $(TARGET) 23 | 24 | PROGRAM = main.o 25 | 26 | OBJS = $(PROGRAM) $(MODULES) 27 | 28 | # dependencies 29 | 30 | $(MODULES) : 31 | $(PROGRAM) : $(MODULES) 32 | 33 | # rules 34 | 35 | $(TARGET): $(MODULES) $(PROGRAM) 36 | $(F90) -o $(TARGET) $(LINKFLAGS) $(OBJS) $(LIBS) $(LIBSP) 37 | 38 | clean: 39 | rm -f *.o *.mod work.pcl 40 | rm -f *.txt 41 | # rm -f *.dat 42 | rm -f *.ps 43 | rm -f *.out 44 | rm -f fort.* *.backup 45 | rm -f main 46 | rm -f *~ 47 | # rm -f *.inp 48 | rm -f *.pdf 49 | -------------------------------------------------------------------------------- /tests/C-tests/diagonalize_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __DIAGONALIZE_MATRIX_H 2 | #define __DIAGONALIZE_MATRIX_H 3 | 4 | #include 5 | 6 | int test_diagonalize( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_diagonalize_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_diagonalize_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_diagonalize_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_diagonalize_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/get_sparsity.h: -------------------------------------------------------------------------------- 1 | #ifndef __GET_SPARSITY_MATRIX_H 2 | #define __GET_SPARSITY_MATRIX_H 3 | 4 | #include 5 | 6 | int test_get_sparsity( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_get_sparsity_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_get_sparsity_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_get_sparsity_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_get_sparsity_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/mpi_sendrecv.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_MPI_SENDRECV_H 2 | #define __TEST_MPI_SENDRECV_H 3 | 4 | #include 5 | 6 | int test_mpi_sendrecv( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_mpi_sendrecv_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_mpi_sendrecv_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_mpi_sendrecv_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_mpi_sendrecv_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/multiply_matrix_x2.h: -------------------------------------------------------------------------------- 1 | #ifndef __MULTIPLY_MATRIX_X2_H 2 | #define __MULTIPLY_MATRIX_X2_H 3 | 4 | #include 5 | 6 | int test_multiply_x2( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_multiply_x2_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_multiply_x2_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_multiply_x2_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_multiply_x2_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/Fortran-interface/bml_fc_tools_m.F90: -------------------------------------------------------------------------------- 1 | module bml_fc_tools_m 2 | 3 | use bml_c_interface_m, only : C_NULL_CHAR, C_CHAR 4 | 5 | implicit none 6 | private 7 | 8 | public :: bml_f_c_string 9 | 10 | integer, parameter :: LEN_C_NULL_CHAR = len(C_NULL_CHAR) 11 | 12 | contains 13 | 14 | !> Returns the trimmed length of the string with NULL termination added. 15 | pure function len_f_c_string(fstr) result(strlen) 16 | 17 | character(len=*, kind=C_CHAR), intent(in) :: fstr 18 | integer :: strlen 19 | 20 | strlen = len_trim(fstr) + LEN_C_NULL_CHAR 21 | 22 | end function len_f_c_string 23 | 24 | !> Returns a NULL terminated C-style string. 25 | !! 26 | !! \param fstr Fortran string. 27 | !! \return cstr The Fortran string terminated with C NULL. 28 | pure function bml_f_c_string(fstr) result(cstr) 29 | 30 | character(len=*, kind=C_CHAR), intent(in) :: fstr 31 | character(len=len_f_c_string(fstr), kind=C_CHAR) :: cstr 32 | 33 | cstr = trim(fstr)//C_NULL_CHAR 34 | 35 | end function bml_f_c_string 36 | 37 | end module bml_fc_tools_m 38 | -------------------------------------------------------------------------------- /src/C-interface/dense/bml_convert_dense.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_CONVERT_DENSE_H 4 | #define __BML_CONVERT_DENSE_H 5 | 6 | #include "bml_types_dense.h" 7 | 8 | bml_matrix_dense_t *bml_convert_dense( 9 | bml_matrix_t * A, 10 | bml_matrix_precision_t matrix_precision, 11 | bml_distribution_mode_t distrib_mode); 12 | 13 | bml_matrix_dense_t *bml_convert_dense_single_real( 14 | bml_matrix_t * A, 15 | bml_matrix_precision_t matrix_precision, 16 | bml_distribution_mode_t distrib_mode); 17 | 18 | bml_matrix_dense_t *bml_convert_dense_double_real( 19 | bml_matrix_t * A, 20 | bml_matrix_precision_t matrix_precision, 21 | bml_distribution_mode_t distrib_mode); 22 | 23 | bml_matrix_dense_t *bml_convert_dense_single_complex( 24 | bml_matrix_t * A, 25 | bml_matrix_precision_t matrix_precision, 26 | bml_distribution_mode_t distrib_mode); 27 | 28 | bml_matrix_dense_t *bml_convert_dense_double_complex( 29 | bml_matrix_t * A, 30 | bml_matrix_precision_t matrix_precision, 31 | bml_distribution_mode_t distrib_mode); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /tests/C-tests/import_export_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __IMPORT_EXPORT_MATRIX_H 2 | #define __IMPORT_EXPORT_MATRIX_H 3 | 4 | #include 5 | 6 | int test_import_export( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_import_export_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_import_export_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_import_export_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_import_export_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /scripts/build_olcf_summit_gnu_mgma_openblas.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | module load cmake 3 | module load cuda 4 | module load gcc/9.3.0 5 | #lapack included in openblas 6 | module load openblas 7 | module load magma 8 | 9 | rm -r build 10 | rm -r install 11 | 12 | MY_PATH=$(pwd) 13 | 14 | #get jsrun with full path 15 | JSRUN=$(which jsrun) 16 | echo ${JSRUN} 17 | 18 | export MAGMA_ROOT=${OLCF_MAGMA_ROOT:="${OLCF_MAGMA_ROOT}"} 19 | export CC=${CC:=gcc} 20 | export FC=${FC:=gfortran} 21 | export CXX=${CXX:=g++} 22 | export BLAS_VENDOR=${BLAS_VENDOR:=OpenBLAS} 23 | export BML_OPENMP=${BML_OPENMP:=yes} 24 | export BML_OMP_OFFLOAD=${BML_OMP_OFFLOAD:=no} 25 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 26 | export BML_TESTING=${BML_TESTING:=yes} 27 | export BML_MAGMA=${BML_MAGMA:=yes} 28 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 29 | 30 | #use jsrun to run tests on a compute node 31 | export BML_NONMPI_PRECOMMAND=${BML_NONMPI_PRECOMMAND:=${JSRUN}} 32 | export BML_NONMPI_PRECOMMAND_ARGS=${BML_NONMPI_PRECOMMAND_ARGS:="-n1;-a1;-g1;-c7;--smpiargs=off"} 33 | 34 | ./build.sh install 35 | -------------------------------------------------------------------------------- /scripts/build_spock_magma_gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure all the paths are correct 4 | 5 | rm -r build 6 | rm -r install 7 | 8 | MY_PATH=$(pwd) 9 | 10 | export CC=${CC:=gcc} 11 | export FC=${FC:=gfortran} 12 | export CXX=${CXX:=g++} 13 | export BLAS_VENDOR=${BLAS_VENDOR:=OpenBLAS} 14 | export BML_OPENMP=${BML_OPENMP:=yes} 15 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 16 | export BML_MAGMA=${BML_MAGMA:=yes} 17 | export MAGMA_ROOT=${OLCF_MAGMA_ROOT} 18 | export BML_ROCSOLVER=${BML_ROCSOLVER:=no} 19 | export BML_TESTING=${BML_TESTING:=yes} 20 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 21 | export CMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS:="-g -ffree-form -ffree-line-length-200"} 22 | export CMAKE_C_FLAGS=${CMAKE_C_FLAGS:="-g -I${HIP_PATH}/include"} 23 | export EXTRA_LINK_FLAGS=${EXTRA_LINK_FLAGS:=""} 24 | 25 | if [[ -z "$CMAKE_PREFIX_PATH" ]]; then 26 | export CMAKE_PREFIX_PATH=${ROCM_PATH} 27 | else 28 | export CMAKE_PREFIX_PATH="${ROCM_PATH};${CMAKE_PREFIX_PATH}" 29 | fi 30 | 31 | ./build.sh configure 32 | 33 | pushd build 34 | make -j8 35 | make install 36 | popd 37 | -------------------------------------------------------------------------------- /src/C-interface/ellpack/bml_inverse_ellpack.c: -------------------------------------------------------------------------------- 1 | #include "../bml_logger.h" 2 | #include "../bml_types.h" 3 | #include "bml_inverse_ellpack.h" 4 | #include "bml_types_ellpack.h" 5 | #include "../bml_utilities.h" 6 | 7 | #include 8 | 9 | /** \page inverse 10 | * 11 | */ 12 | 13 | bml_matrix_ellpack_t * 14 | bml_inverse_ellpack( 15 | bml_matrix_ellpack_t * A) 16 | { 17 | 18 | bml_matrix_ellpack_t *B = NULL; 19 | 20 | switch (A->matrix_precision) 21 | { 22 | case single_real: 23 | B = bml_inverse_ellpack_single_real(A); 24 | break; 25 | case double_real: 26 | B = bml_inverse_ellpack_double_real(A); 27 | break; 28 | #ifdef BML_COMPLEX 29 | case single_complex: 30 | B = bml_inverse_ellpack_single_complex(A); 31 | break; 32 | case double_complex: 33 | B = bml_inverse_ellpack_double_complex(A); 34 | break; 35 | #endif 36 | default: 37 | LOG_ERROR("unknown precision\n"); 38 | break; 39 | } 40 | 41 | return B; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /tests/C-tests/get_set_diagonal.h: -------------------------------------------------------------------------------- 1 | #ifndef __GET_SET_DIAGONAL_MATRIX_H 2 | #define __GET_SET_DIAGONAL_MATRIX_H 3 | 4 | #include 5 | 6 | int test_get_set_diagonal( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_get_set_diagonal_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_get_set_diagonal_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_get_set_diagonal_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_get_set_diagonal_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/C-tests/multiply_banded_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __MULTIPLY_BANDED_MATRIX_H 2 | #define __MULTIPLY_BANDED_MATRIX_H 3 | 4 | #include 5 | 6 | int test_multiply_banded( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_multiply_banded_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_multiply_banded_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_multiply_banded_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_multiply_banded_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /scripts/build_crusher_magma_gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure all the paths are correct 4 | 5 | rm -r build 6 | rm -r install 7 | 8 | MY_PATH=$(pwd) 9 | 10 | export CC=${CC:=gcc} 11 | export FC=${FC:=gfortran} 12 | export CXX=${CXX:=g++} 13 | export BLAS_VENDOR=${BLAS_VENDOR:=OpenBLAS} 14 | export BML_OPENMP=${BML_OPENMP:=yes} 15 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 16 | export BML_MAGMA=${BML_MAGMA:=yes} 17 | export MAGMA_ROOT=${OLCF_MAGMA_ROOT} 18 | export BML_ROCSOLVER=${BML_ROCSOLVER:=no} 19 | export BML_TESTING=${BML_TESTING:=yes} 20 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 21 | export CMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS:="-g -ffree-form -ffree-line-length-200"} 22 | export CMAKE_C_FLAGS=${CMAKE_C_FLAGS:="-g -I${HIP_PATH}/include"} 23 | export EXTRA_LINK_FLAGS=${EXTRA_LINK_FLAGS:=""} 24 | 25 | if [[ -z "$CMAKE_PREFIX_PATH" ]]; then 26 | export CMAKE_PREFIX_PATH=${ROCM_PATH} 27 | else 28 | export CMAKE_PREFIX_PATH="${ROCM_PATH};${CMAKE_PREFIX_PATH}" 29 | fi 30 | 31 | ./build.sh configure 32 | 33 | pushd build 34 | make -j8 35 | make install 36 | popd 37 | -------------------------------------------------------------------------------- /scripts/build_olcf_summit_gnu_offload_openblas.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | module load cmake 3 | module load cuda 4 | module load gcc/11.2.0 5 | module load openblas 6 | 7 | rm -r build 8 | rm -r install 9 | 10 | MY_PATH=$(pwd) 11 | 12 | #get jsrun with full path 13 | JSRUN=$(which jsrun) 14 | echo ${JSRUN} 15 | 16 | export CC=${CC:=gcc} 17 | export FC=${FC:=gfortran} 18 | export CXX=${CXX:=g++} 19 | export BLAS_VENDOR=${BLAS_VENDOR:=OpenBLAS} 20 | export BML_OPENMP=${BML_OPENMP:=yes} 21 | export BML_OMP_OFFLOAD=${BML_OMP_OFFLOAD:=yes} 22 | export INSTALL_DIR=${INSTALL_DIR:="${MY_PATH}/install"} 23 | export BML_TESTING=${BML_TESTING:=yes} 24 | export BML_COMPLEX=${BML_COMPLEX:=no} 25 | export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} 26 | export EXTRA_LINK_FLAGS=${EXTRA_LINK_FLAGS:="-latomic"} 27 | export BML_CUSPARSE=${BML_CUSPARSE:=yes} 28 | export BML_COMPLEX=${BML_COMPLEX:=no} 29 | 30 | #use jsrun to run tests on a compute node 31 | export BML_NONMPI_PRECOMMAND=${BML_NONMPI_PRECOMMAND:=${JSRUN}} 32 | export BML_NONMPI_PRECOMMAND_ARGS=${BML_NONMPI_PRECOMMAND_ARGS:="-n1;-a1;-g1;-c7"} 33 | 34 | ./build.sh install 35 | -------------------------------------------------------------------------------- /tests/C-tests/element_multiply_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __ELEMENT_MULTIPLY_MATRIX_H 2 | #define __ELEMENT_MULTIPLY_MATRIX_H 3 | 4 | #include 5 | 6 | int test_element_multiply( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_element_multiply_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_element_multiply_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_element_multiply_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_element_multiply_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/C-interface/dense/bml_trace_dense.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_TRACE_DENSE_H 2 | #define __BML_TRACE_DENSE_H 3 | 4 | #include "bml_types_dense.h" 5 | 6 | double bml_trace_dense( 7 | bml_matrix_dense_t * A); 8 | 9 | double bml_trace_dense_single_real( 10 | bml_matrix_dense_t * A); 11 | 12 | double bml_trace_dense_double_real( 13 | bml_matrix_dense_t * A); 14 | 15 | double bml_trace_dense_single_complex( 16 | bml_matrix_dense_t * A); 17 | 18 | double bml_trace_dense_double_complex( 19 | bml_matrix_dense_t * A); 20 | 21 | double bml_trace_mult_dense( 22 | bml_matrix_dense_t * A, 23 | bml_matrix_dense_t * B); 24 | 25 | double bml_trace_mult_dense_single_real( 26 | bml_matrix_dense_t * A, 27 | bml_matrix_dense_t * B); 28 | 29 | double bml_trace_mult_dense_double_real( 30 | bml_matrix_dense_t * A, 31 | bml_matrix_dense_t * B); 32 | 33 | double bml_trace_mult_dense_single_complex( 34 | bml_matrix_dense_t * A, 35 | bml_matrix_dense_t * B); 36 | 37 | double bml_trace_mult_dense_double_complex( 38 | bml_matrix_dense_t * A, 39 | bml_matrix_dense_t * B); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/C-interface/ellblock/bml_inverse_ellblock.c: -------------------------------------------------------------------------------- 1 | #include "../bml_logger.h" 2 | #include "../bml_types.h" 3 | #include "bml_inverse_ellblock.h" 4 | #include "bml_types_ellblock.h" 5 | #include "../bml_utilities.h" 6 | 7 | #include 8 | 9 | /** \page inverse 10 | * 11 | */ 12 | 13 | bml_matrix_ellblock_t * 14 | bml_inverse_ellblock( 15 | bml_matrix_ellblock_t * A) 16 | { 17 | 18 | bml_matrix_ellblock_t *B = NULL; 19 | 20 | switch (A->matrix_precision) 21 | { 22 | case single_real: 23 | B = bml_inverse_ellblock_single_real(A); 24 | break; 25 | case double_real: 26 | B = bml_inverse_ellblock_double_real(A); 27 | break; 28 | #ifdef BML_COMPLEX 29 | case single_complex: 30 | B = bml_inverse_ellblock_single_complex(A); 31 | break; 32 | case double_complex: 33 | B = bml_inverse_ellblock_double_complex(A); 34 | break; 35 | #endif 36 | default: 37 | LOG_ERROR("unknown precision\n"); 38 | break; 39 | } 40 | 41 | return B; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /tests/C-tests/adjungate_triangle_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __ADJUNGATE_TRIANGLE_H 2 | #define __ADJUNGATE_TRIANGLE_H 3 | 4 | #include 5 | 6 | int test_adjungate_triangle( 7 | const int N, 8 | const bml_matrix_type_t matrix_type, 9 | const bml_matrix_precision_t matrix_precision, 10 | const int M); 11 | 12 | int test_adjungate_triangle_single_real( 13 | const int N, 14 | const bml_matrix_type_t matrix_type, 15 | const bml_matrix_precision_t matrix_precision, 16 | const int M); 17 | 18 | int test_adjungate_triangle_double_real( 19 | const int N, 20 | const bml_matrix_type_t matrix_type, 21 | const bml_matrix_precision_t matrix_precision, 22 | const int M); 23 | 24 | int test_adjungate_triangle_single_complex( 25 | const int N, 26 | const bml_matrix_type_t matrix_type, 27 | const bml_matrix_precision_t matrix_precision, 28 | const int M); 29 | 30 | int test_adjungate_triangle_double_complex( 31 | const int N, 32 | const bml_matrix_type_t matrix_type, 33 | const bml_matrix_precision_t matrix_precision, 34 | const int M); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /docs/API/bml__parallel_8h.js: -------------------------------------------------------------------------------- 1 | var bml__parallel_8h = 2 | [ 3 | [ "bml_allGatherVParallel", "bml__parallel_8h.html#aefbce4ada56f7e873bf9194d11836f03", null ], 4 | [ "bml_barrierParallel", "bml__parallel_8h.html#ae85bdd5ac89b113be6521c76f9b53f89", null ], 5 | [ "bml_getMyRank", "bml__parallel_8h.html#a3b0afce75822d733bd695bb11681841a", null ], 6 | [ "bml_getNRanks", "bml__parallel_8h.html#a56f2a8d8e4902f16e3f84afacd4aa159", null ], 7 | [ "bml_initParallelF", "bml__parallel_8h.html#ab07fbe97aedb8616c0cbbbab2605e9d3", null ], 8 | [ "bml_maxRealReduce", "bml__parallel_8h.html#a8406ad02664bb9bcc2cf912b11359887", null ], 9 | [ "bml_minRealReduce", "bml__parallel_8h.html#a1202a5ea7f9371b1da3dcc547f722da2", null ], 10 | [ "bml_printRank", "bml__parallel_8h.html#a39635f967e2691f99e7e7d6e89d477f7", null ], 11 | [ "bml_shutdownParallel", "bml__parallel_8h.html#a5889e61f782cb7c9486e5aef7ac6b019", null ], 12 | [ "bml_shutdownParallelF", "bml__parallel_8h.html#a1133beb7c8cb9c97a52ebe5dc16815c6", null ], 13 | [ "bml_sumRealReduce", "bml__parallel_8h.html#adbf5a5a299826b096ffdb82f7c24584a", null ] 14 | ]; -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_threshold_distributed2d.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_THRESHOLD_DISTRIBUTED2D_H 2 | #define __BML_THRESHOLD_DISTRIBUTED2D_H 3 | 4 | #include "bml_types_distributed2d.h" 5 | 6 | bml_matrix_distributed2d_t *bml_threshold_new_distributed2d( 7 | bml_matrix_distributed2d_t * A, 8 | double threshold); 9 | 10 | bml_matrix_distributed2d_t 11 | * bml_threshold_new_distributed2d_single_real(bml_matrix_distributed2d_t * 12 | A, double threshold); 13 | 14 | bml_matrix_distributed2d_t 15 | * bml_threshold_new_distributed2d_double_real(bml_matrix_distributed2d_t * 16 | A, double threshold); 17 | 18 | bml_matrix_distributed2d_t 19 | * 20 | bml_threshold_new_distributed2d_single_complex(bml_matrix_distributed2d_t * A, 21 | double threshold); 22 | 23 | bml_matrix_distributed2d_t 24 | * 25 | bml_threshold_new_distributed2d_double_complex(bml_matrix_distributed2d_t * A, 26 | double threshold); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /docs/API/search/enumvalues_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['dense_330',['dense',['../bml__types_8h.html#ab7d3c21318898af00e7c28712f369842ae8716347cc7fdaf9fc25cc0e20c2ab26',1,'bml_types.h']]], 4 | ['dense_5fcolumn_5fmajor_331',['dense_column_major',['../bml__types_8h.html#aee75766924480bd077ae554927c85233a9604ec32306f68f7f9b7f92ae8d0b600',1,'bml_types.h']]], 5 | ['dense_5frow_5fmajor_332',['dense_row_major',['../bml__types_8h.html#aee75766924480bd077ae554927c85233a49a37e300b888e838954d75ba69a6392',1,'bml_types.h']]], 6 | ['distributed_333',['distributed',['../bml__types_8h.html#a4bed60baf88d95c03a021ed4b166a522a624d67136268cb0f80f193a432f803c0',1,'bml_types.h']]], 7 | ['distributed2d_334',['distributed2d',['../bml__types_8h.html#ab7d3c21318898af00e7c28712f369842aa4ec306759a6a7076aee2d7bf1289309',1,'bml_types.h']]], 8 | ['double_5fcomplex_335',['double_complex',['../bml__types_8h.html#a8d762ed64876f48d5eb687cb62f20d5ca9e8955d27a2db22bf39bdb8b9af4e543',1,'bml_types.h']]], 9 | ['double_5freal_336',['double_real',['../bml__types_8h.html#a8d762ed64876f48d5eb687cb62f20d5cabc5f098fe5cb31d71e85d8be8b85b03a',1,'bml_types.h']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /src/C-interface/bml_norm.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_NORM_H 4 | #define __BML_NORM_H 5 | 6 | #include "bml_types.h" 7 | 8 | // Calculate the sum of squares of all the elements in A 9 | double bml_sum_squares( 10 | bml_matrix_t * A); 11 | 12 | // Calculate the sum of squares of all the elements of 13 | // alpha * A + beta * B 14 | double bml_sum_squares2( 15 | bml_matrix_t * A, 16 | bml_matrix_t * B, 17 | double alpha, 18 | double beta, 19 | double threshold); 20 | 21 | // Calculate the sum of all the elements of 22 | // alpha * A(i,j)* B(i,j) 23 | double bml_sum_AB( 24 | bml_matrix_t * A, 25 | bml_matrix_t * B, 26 | double alpha, 27 | double threshold); 28 | 29 | // Calculate the sum of squares for submatrix core elements 30 | double bml_sum_squares_submatrix( 31 | bml_matrix_t * A, 32 | int core_size); 33 | 34 | // Calculate Frobenius norm for matrix A 35 | // sqrt(sum(A_ij*A_ij) 36 | double bml_fnorm( 37 | bml_matrix_t * A); 38 | 39 | // Calculate Frobenius norm for 2 matrices 40 | double bml_fnorm2( 41 | bml_matrix_t * A, 42 | bml_matrix_t * B); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/C-interface/csr/bml_convert_csr.h: -------------------------------------------------------------------------------- 1 | /** \file */ 2 | 3 | #ifndef __BML_CONVERT_CSR_H 4 | #define __BML_CONVERT_CSR_H 5 | 6 | #include "bml_types_csr.h" 7 | 8 | bml_matrix_csr_t *bml_convert_csr( 9 | bml_matrix_t * A, 10 | bml_matrix_precision_t matrix_precision, 11 | int M, 12 | bml_distribution_mode_t distrib_mode); 13 | 14 | bml_matrix_csr_t *bml_convert_csr_single_real( 15 | bml_matrix_t * A, 16 | bml_matrix_precision_t matrix_precision, 17 | int M, 18 | bml_distribution_mode_t distrib_mode); 19 | 20 | bml_matrix_csr_t *bml_convert_csr_double_real( 21 | bml_matrix_t * A, 22 | bml_matrix_precision_t matrix_precision, 23 | int M, 24 | bml_distribution_mode_t distrib_mode); 25 | 26 | bml_matrix_csr_t *bml_convert_csr_single_complex( 27 | bml_matrix_t * A, 28 | bml_matrix_precision_t matrix_precision, 29 | int M, 30 | bml_distribution_mode_t distrib_mode); 31 | 32 | bml_matrix_csr_t *bml_convert_csr_double_complex( 33 | bml_matrix_t * A, 34 | bml_matrix_precision_t matrix_precision, 35 | int M, 36 | bml_distribution_mode_t distrib_mode); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_convert_distributed2d.c: -------------------------------------------------------------------------------- 1 | #include "../bml_introspection.h" 2 | #include "../bml_convert.h" 3 | #include "../bml_logger.h" 4 | #include "bml_allocate_distributed2d.h" 5 | #include "bml_convert_distributed2d.h" 6 | #include "bml_introspection_distributed2d.h" 7 | 8 | #include 9 | 10 | bml_matrix_distributed2d_t * 11 | bml_convert_distributed2d( 12 | bml_matrix_t * A, 13 | bml_matrix_type_t matrix_type, 14 | bml_matrix_precision_t matrix_precision, 15 | int M) 16 | { 17 | assert(A != NULL); 18 | int N = bml_get_N(A); 19 | bml_matrix_distributed2d_t *B = bml_zero_matrix_distributed2d(matrix_type, 20 | matrix_precision, 21 | N, 22 | M); 23 | bml_matrix_t *matrix = bml_get_local_matrix(A); 24 | int m = bml_get_M(matrix); 25 | B->matrix = bml_convert(matrix, matrix_type, 26 | matrix_precision, m, sequential); 27 | 28 | return B; 29 | } 30 | -------------------------------------------------------------------------------- /src/C-interface/ellpack/bml_element_multiply_ellpack.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_ELEMNET_MULTIPLY_ELLPACK_H 2 | #define __BML_ELEMNET_MULTIPLY_ELLPACK_H 3 | 4 | #include "bml_types_ellpack.h" 5 | 6 | void bml_element_multiply_AB_ellpack( 7 | bml_matrix_ellpack_t * A, 8 | bml_matrix_ellpack_t * B, 9 | bml_matrix_ellpack_t * C, 10 | double threshold); 11 | 12 | void bml_element_multiply_AB_ellpack_single_real( 13 | bml_matrix_ellpack_t * A, 14 | bml_matrix_ellpack_t * B, 15 | bml_matrix_ellpack_t * C, 16 | double threshold); 17 | 18 | void bml_element_multiply_AB_ellpack_double_real( 19 | bml_matrix_ellpack_t * A, 20 | bml_matrix_ellpack_t * B, 21 | bml_matrix_ellpack_t * C, 22 | double threshold); 23 | 24 | void bml_element_multiply_AB_ellpack_single_complex( 25 | bml_matrix_ellpack_t * A, 26 | bml_matrix_ellpack_t * B, 27 | bml_matrix_ellpack_t * C, 28 | double threshold); 29 | 30 | void bml_element_multiply_AB_ellpack_double_complex( 31 | bml_matrix_ellpack_t * A, 32 | bml_matrix_ellpack_t * B, 33 | bml_matrix_ellpack_t * C, 34 | double threshold); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/C-interface/csr/bml_trace_csr.h: -------------------------------------------------------------------------------- 1 | #ifndef __BML_TRACE_CSR_H 2 | #define __BML_TRACE_CSR_H 3 | 4 | #include "bml_types_csr.h" 5 | 6 | double bml_trace_csr( 7 | const bml_matrix_csr_t * A); 8 | 9 | double bml_trace_csr_single_real( 10 | const bml_matrix_csr_t * A); 11 | 12 | double bml_trace_csr_double_real( 13 | const bml_matrix_csr_t * A); 14 | 15 | double bml_trace_csr_single_complex( 16 | const bml_matrix_csr_t * A); 17 | 18 | double bml_trace_csr_double_complex( 19 | const bml_matrix_csr_t * A); 20 | 21 | double bml_trace_mult_csr( 22 | const bml_matrix_csr_t * A, 23 | const bml_matrix_csr_t * B); 24 | 25 | double bml_trace_mult_csr_single_real( 26 | const bml_matrix_csr_t * A, 27 | const bml_matrix_csr_t * B); 28 | 29 | double bml_trace_mult_csr_double_real( 30 | const bml_matrix_csr_t * A, 31 | const bml_matrix_csr_t * B); 32 | 33 | double bml_trace_mult_csr_single_complex( 34 | const bml_matrix_csr_t * A, 35 | const bml_matrix_csr_t * B); 36 | 37 | double bml_trace_mult_csr_double_complex( 38 | const bml_matrix_csr_t * A, 39 | const bml_matrix_csr_t * B); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/C-interface/distributed2d/bml_threshold_distributed2d.c: -------------------------------------------------------------------------------- 1 | #include "../bml_threshold.h" 2 | #include "../bml_types.h" 3 | #include "../bml_introspection.h" 4 | #include "../bml_copy.h" 5 | #include "bml_threshold_distributed2d.h" 6 | #include "bml_types_distributed2d.h" 7 | #include "bml_allocate_distributed2d.h" 8 | 9 | #include 10 | 11 | /** Threshold a matrix. 12 | * 13 | * \ingroup threshold_group 14 | * 15 | * \param A The matrix to be thresholded 16 | * \param threshold Threshold value 17 | * \return the thresholded A 18 | */ 19 | bml_matrix_distributed2d_t 20 | * bml_threshold_new_distributed2d(bml_matrix_distributed2d_t * A, 21 | double threshold) 22 | { 23 | assert(A->M > 0); 24 | 25 | bml_matrix_distributed2d_t *B = 26 | bml_noinit_matrix_distributed2d(bml_get_type(A->matrix), 27 | bml_get_precision(A->matrix), A->N, 28 | A->M); 29 | // copy local block 30 | bml_copy(A->matrix, B->matrix); 31 | 32 | bml_threshold(B->matrix, threshold); 33 | 34 | return B; 35 | } 36 | -------------------------------------------------------------------------------- /docs/API/search/all_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['localdispl_158',['localDispl',['../structbml__domain__t.html#acb9190cb6c82b27f0d5ca8266ad3688f',1,'bml_domain_t']]], 4 | ['localelements_159',['localElements',['../structbml__domain__t.html#a11da61b7f6cdfffeee90c055bd2ccd62',1,'bml_domain_t']]], 5 | ['localrowextent_160',['localRowExtent',['../structbml__domain__t.html#a587a4b292cb6278115500bf495eca5b4',1,'bml_domain_t']]], 6 | ['localrowmax_161',['localRowMax',['../structbml__domain__t.html#a4eb3339f51b2754baee5b66419e98c12',1,'bml_domain_t']]], 7 | ['localrowmin_162',['localRowMin',['../structbml__domain__t.html#ac4a952e1dd5dd37776a67004579deab5',1,'bml_domain_t']]], 8 | ['log_5fdebug_163',['LOG_DEBUG',['../bml__logger_8h.html#abd0b0523397fb05f0ed46fc217fb630f',1,'bml_logger.h']]], 9 | ['log_5ferror_164',['LOG_ERROR',['../bml__logger_8h.html#abffaf9cecb61026cac6db71a16ace9c5',1,'bml_logger.h']]], 10 | ['log_5finfo_165',['LOG_INFO',['../bml__logger_8h.html#a89681da4efde0b54dc7f2839665082c8',1,'bml_logger.h']]], 11 | ['log_5fwarn_166',['LOG_WARN',['../bml__logger_8h.html#a31e7ff3be0d7ddbd843b3335b534bd03',1,'bml_logger.h']]] 12 | ]; 13 | -------------------------------------------------------------------------------- /src/internal-blas/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Public headers. 2 | set(HEADERS-INTERNAL-BLAS 3 | bml_gemm.h) 4 | install(FILES ${HEADERS-C} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) 5 | 6 | set(SOURCES-INTERNAL-BLAS 7 | bml_gemm.c) 8 | 9 | include(${PROJECT_SOURCE_DIR}/cmake/bmlAddTypedLibrary.cmake) 10 | bml_add_typed_library(bml-internal-blas single_real "${SOURCES-INTERNAL-BLAS}") 11 | bml_add_typed_library(bml-internal-blas double_real "${SOURCES-INTERNAL-BLAS}") 12 | bml_add_typed_library(bml-internal-blas single_complex "${SOURCES-INTERNAL-BLAS}") 13 | bml_add_typed_library(bml-internal-blas double_complex "${SOURCES-INTERNAL-BLAS}") 14 | 15 | if(OPENMP_FOUND) 16 | set_target_properties(bml-internal-blas-single_real 17 | PROPERTIES 18 | COMPILE_FLAGS ${OpenMP_C_FLAGS}) 19 | set_target_properties(bml-internal-blas-double_real 20 | PROPERTIES 21 | COMPILE_FLAGS ${OpenMP_C_FLAGS}) 22 | set_target_properties(bml-internal-blas-single_complex 23 | PROPERTIES 24 | COMPILE_FLAGS ${OpenMP_C_FLAGS}) 25 | set_target_properties(bml-internal-blas-double_complex 26 | PROPERTIES 27 | COMPILE_FLAGS ${OpenMP_C_FLAGS}) 28 | endif() 29 | -------------------------------------------------------------------------------- /tests/C-tests/add_matrix.c: -------------------------------------------------------------------------------- 1 | #include "bml.h" 2 | #include "bml_test.h" 3 | 4 | #include 5 | 6 | int 7 | test_add( 8 | const int N, 9 | const bml_matrix_type_t matrix_type, 10 | const bml_matrix_precision_t matrix_precision, 11 | const int M) 12 | { 13 | switch (matrix_precision) 14 | { 15 | case single_real: 16 | return test_add_single_real(N, matrix_type, matrix_precision, M); 17 | break; 18 | case double_real: 19 | return test_add_double_real(N, matrix_type, matrix_precision, M); 20 | break; 21 | #ifdef BML_COMPLEX 22 | case single_complex: 23 | return test_add_single_complex(N, matrix_type, matrix_precision, 24 | M); 25 | break; 26 | case double_complex: 27 | return test_add_double_complex(N, matrix_type, matrix_precision, 28 | M); 29 | break; 30 | #endif 31 | default: 32 | fprintf(stderr, "unknown matrix precision\n"); 33 | return -1; 34 | break; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.github/workflows/stale.yaml: -------------------------------------------------------------------------------- 1 | name: 'Close stale issues and PR' 2 | on: 3 | schedule: 4 | - cron: '30 1 * * *' 5 | workflow_dispatch: 6 | permissions: 7 | issues: write 8 | pull-requests: write 9 | 10 | jobs: 11 | stale: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/stale@v5 15 | with: 16 | stale-issue-message: >- 17 | This issue is stale because it has been open for 90 days with no 18 | activity. Remove the stale label or comment or this will be closed 19 | in 30 days. 20 | close-issue-message: >- 21 | This issue was closed because it has been stale for 90 days 22 | with no activity. 23 | days-before-issue-stale: 90 24 | days-before-issue-close: 30 25 | stale-pr-message: >- 26 | This PR is stale because it has been open for 90 days with no 27 | activity. 28 | close-pr-message: >- 29 | This PR was closed because it has been stale for 90 days 30 | with no activity. 31 | days-before-pr-stale: 90 32 | days-before-pr-close: -1 33 | --------------------------------------------------------------------------------