Skip to content
Snippets Groups Projects
Select Git revision
  • 01c24df8f02c2860313d7c31ad0dc4479e16e3c0
  • master default protected
  • noelp-master-patch-87404
  • disable-view
  • experimental_rel
  • test_quiggeldy_service
  • update-arbor-0.10.0
  • image_build
  • spack_v0.22.1
  • ebrains-24-04
  • update-readme
  • create-module-file
  • add-nestml-tests
  • feat_add_py-norse
  • update-libneuroml
  • update-bluebrain-packages
  • feat_arbor_install_all_binaries
  • ebrains-23.09-jsc-site-config
  • spack-v0.20.0
  • ebrains-23-09-spack-v0.19.2
  • ebrains-23-09
21 results

create_JupyterLab_kernel.sh

Blame
  • config.cpp 1.44 KiB
    #include <iomanip>
    #include <ios>
    #include <sstream>
    
    #include <pybind11/pybind11.h>
    #include <pybind11/stl.h>
    
    #include <arbor/version.hpp>
    
    namespace pyarb {
    
    // Returns a python dictionary that python users can use to look up
    // which options the Arbor library was configured with at compile time.
    
    pybind11::dict config() {
        pybind11::dict dict;
    #ifdef ARB_MPI_ENABLED
        dict[pybind11::str("mpi")]     = pybind11::bool_(true);
    #else
        dict[pybind11::str("mpi")]     = pybind11::bool_(false);
    #endif
    #ifdef ARB_WITH_MPI4PY
        dict[pybind11::str("mpi4py")]  = pybind11::bool_(true);
    #else
        dict[pybind11::str("mpi4py")]  = pybind11::bool_(false);
    #endif
    #ifdef ARB_WITH_GPU
        dict[pybind11::str("gpu")]     = pybind11::bool_(true);
    #else
        dict[pybind11::str("gpu")]     = pybind11::bool_(false);
    #endif
        dict[pybind11::str("version")] = pybind11::str(ARB_VERSION);
        return dict;
    }
    
    void print_config(const pybind11::dict &d) {
        std::stringstream s;
        s << "Arbor's configuration:\n";
    
        for (auto x: d) {
            s << "     "
            << std::left << std::setw(7) << x.first << ": "
            << std::right << std::setw(10) << x.second << "\n";
        }
    
        pybind11::print(s.str());
    }
    
    // Register configuration
    void register_config(pybind11::module &m) {
    
        m.def("config", &config, "Get Arbor's configuration.")
         .def("print_config", [](const pybind11::dict& d){return print_config(d);}, "Print Arbor's configuration.");
    }
    } // namespace pyarb