cuBNM 0.0.1__tar.gz → 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cubnm-0.0.2/MANIFEST.in +3 -0
- {cuBNM-0.0.1/src/cuBNM.egg-info → cubnm-0.0.2}/PKG-INFO +2 -28
- cubnm-0.0.2/README.rst +176 -0
- cubnm-0.0.2/include/cubnm/bnm.cuh +32 -0
- cubnm-0.0.2/include/cubnm/bnm.hpp +12 -0
- cubnm-0.0.2/include/cubnm/defines.h +51 -0
- cubnm-0.0.2/include/cubnm/fc.cuh +34 -0
- cubnm-0.0.2/include/cubnm/includes.cuh +29 -0
- cubnm-0.0.2/include/cubnm/models/base.cuh +4 -0
- cubnm-0.0.2/include/cubnm/models/base.hpp +291 -0
- cubnm-0.0.2/include/cubnm/models/bw.cuh +10 -0
- cubnm-0.0.2/include/cubnm/models/bw.hpp +24 -0
- cubnm-0.0.2/include/cubnm/models/rww.cuh +18 -0
- cubnm-0.0.2/include/cubnm/models/rww.hpp +259 -0
- cubnm-0.0.2/include/cubnm/models/rww_fic.hpp +19 -0
- cubnm-0.0.2/include/cubnm/models/rwwex.cuh +13 -0
- cubnm-0.0.2/include/cubnm/models/rwwex.hpp +177 -0
- cubnm-0.0.2/include/cubnm/utils.cuh +18 -0
- {cuBNM-0.0.1/src/cpp → cubnm-0.0.2/include/cubnm}/utils.hpp +5 -5
- {cuBNM-0.0.1 → cubnm-0.0.2}/pyproject.toml +6 -13
- {cuBNM-0.0.1 → cubnm-0.0.2}/setup.py +77 -39
- cubnm-0.0.2/src/cubnm/__init__.py +1 -0
- cubnm-0.0.2/src/cubnm/_core.py +17 -0
- cubnm-0.0.2/src/cubnm/_setup_opts.py +6 -0
- cubnm-0.0.2/src/cubnm/data/ctx_parc-schaefer-100_desc-2maps_minmax.txt +2 -0
- cubnm-0.0.2/src/cubnm/data/ctx_parc-schaefer-100_desc-2maps_zscore.txt +2 -0
- cubnm-0.0.2/src/cubnm/datasets.py +125 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/optimize.py +388 -105
- cubnm-0.0.2/src/cubnm/sim.py +880 -0
- cubnm-0.0.2/src/cubnm/utils.py +85 -0
- {cuBNM-0.0.1 → cubnm-0.0.2/src/cubnm.egg-info}/PKG-INFO +2 -28
- {cuBNM-0.0.1/src/cuBNM.egg-info → cubnm-0.0.2/src/cubnm.egg-info}/SOURCES.txt +63 -39
- cubnm-0.0.2/src/cubnm.egg-info/top_level.txt +2 -0
- cubnm-0.0.2/src/ext/bnm.cpp +744 -0
- cubnm-0.0.2/src/ext/bnm.cu +1569 -0
- cubnm-0.0.2/src/ext/core.cpp +499 -0
- cubnm-0.0.2/src/ext/fc.cpp +92 -0
- cubnm-0.0.2/src/ext/fc.cu +226 -0
- cubnm-0.0.2/src/ext/models/base.cpp +13 -0
- cubnm-0.0.2/src/ext/models/bw.cpp +35 -0
- cubnm-0.0.2/src/ext/models/bw.cu +15 -0
- cubnm-0.0.2/src/ext/models/rww.cpp +304 -0
- cubnm-0.0.2/src/ext/models/rww.cu +149 -0
- cubnm-0.0.2/src/ext/models/rww_fic.cpp +199 -0
- cubnm-0.0.2/src/ext/models/rwwex.cpp +57 -0
- cubnm-0.0.2/src/ext/models/rwwex.cu +42 -0
- {cuBNM-0.0.1/src/cpp → cubnm-0.0.2/src/ext}/utils.cpp +18 -19
- cubnm-0.0.2/src/ext/utils.cu +56 -0
- cuBNM-0.0.1/MANIFEST.in +0 -4
- cuBNM-0.0.1/README.md +0 -25
- cuBNM-0.0.1/src/cpp/bnm.cpp +0 -646
- cuBNM-0.0.1/src/cpp/constants.cpp +0 -125
- cuBNM-0.0.1/src/cpp/constants.hpp +0 -117
- cuBNM-0.0.1/src/cpp/fic.cpp +0 -359
- cuBNM-0.0.1/src/cpp/run_simulations.cpp +0 -273
- cuBNM-0.0.1/src/cuBNM/__init__.py +0 -1
- cuBNM-0.0.1/src/cuBNM/_run_simulations.py +0 -18
- cuBNM-0.0.1/src/cuBNM/_setup_flags.py +0 -3
- cuBNM-0.0.1/src/cuBNM/datasets.py +0 -104
- cuBNM-0.0.1/src/cuBNM/sim.py +0 -324
- cuBNM-0.0.1/src/cuBNM/utils.py +0 -20
- cuBNM-0.0.1/src/cuBNM.egg-info/top_level.txt +0 -3
- cuBNM-0.0.1/src/cuda/bnm.cu +0 -1308
- cuBNM-0.0.1/tests/test_core.py +0 -179
- {cuBNM-0.0.1 → cubnm-0.0.2}/LICENSE +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_blas.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_blas_types.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_char.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_complex_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_complex_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_complex_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_long.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_short.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_uchar.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_uint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_ulong.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_block_ushort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_bspline.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_bst.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_bst_avl.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_bst_rb.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_bst_types.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_cblas.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_cdf.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_chebyshev.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_check_range.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_combination.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_complex.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_complex_math.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_const.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_const_cgs.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_const_cgsm.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_const_mks.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_const_mksa.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_const_num.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_deriv.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_dft_complex.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_dft_complex_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_dht.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_diff.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_eigen.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_errno.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_fft.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_fft_complex.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_fft_complex_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_fft_halfcomplex.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_fft_halfcomplex_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_fft_real.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_fft_real_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_filter.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_fit.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_heapsort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_histogram.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_histogram2d.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_ieee_utils.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_inline.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_integration.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_interp.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_interp2d.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_linalg.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_machine.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_math.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_char.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_complex_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_complex_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_complex_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_long.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_short.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_uchar.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_uint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_ulong.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_matrix_ushort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_message.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_min.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_minmax.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_mode.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_monte.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_monte_miser.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_monte_plain.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_monte_vegas.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_movstat.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_multifit.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_multifit_nlin.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_multifit_nlinear.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_multilarge.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_multilarge_nlinear.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_multimin.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_multiroots.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_multiset.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_nan.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_ntuple.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_odeiv.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_odeiv2.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permutation.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_char.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_complex_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_complex_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_complex_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_long.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_char.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_complex_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_complex_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_complex_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_long.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_short.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_uchar.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_uint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_ulong.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_matrix_ushort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_short.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_uchar.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_uint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_ulong.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_ushort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_char.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_complex_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_complex_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_complex_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_long.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_short.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_uchar.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_uint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_ulong.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_permute_vector_ushort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_poly.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_pow_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_precision.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_qrng.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_randist.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_rng.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_roots.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_rstat.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_airy.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_bessel.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_clausen.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_coulomb.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_coupling.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_dawson.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_debye.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_dilog.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_elementary.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_ellint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_elljac.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_erf.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_exp.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_expint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_fermi_dirac.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_gamma.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_gegenbauer.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_hermite.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_hyperg.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_laguerre.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_lambert.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_legendre.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_log.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_mathieu.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_pow_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_psi.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_result.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_sincos_pi.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_synchrotron.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_transport.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_trig.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sf_zeta.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_siman.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_char.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_long.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_short.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_uchar.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_uint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_ulong.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_ushort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_char.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_long.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_short.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_uchar.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_uint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_ulong.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sort_vector_ushort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spblas.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_specfunc.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_splinalg.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spline.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spline2d.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_char.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_complex_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_complex_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_complex_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_long.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_short.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_uchar.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_uint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_ulong.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_spmatrix_ushort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_char.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_long.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_short.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_uchar.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_uint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_ulong.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_statistics_ushort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sum.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_sys.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_test.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_types.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_char.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_complex.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_complex_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_complex_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_complex_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_float.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_int.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_long.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_long_double.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_short.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_uchar.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_uint.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_ulong.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_vector_ushort.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_version.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_wavelet.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/gsl_wavelet2d.h +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/include/gsl/test_source.c +0 -0
- {cuBNM-0.0.1 → cubnm-0.0.2}/setup.cfg +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-aparc_approach-median_mean001_desc-length.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-aparc_approach-median_mean001_desc-strength.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-100_approach-median_mean001_desc-length.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-100_approach-median_mean001_desc-strength.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-100_desc-6maps_minmax.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-100_desc-6maps_zscore.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-100_desc-yeo7.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-100_hemi-LR_desc-FCDtril.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-100_hemi-LR_desc-FCtril.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-100_hemi-LR_exc-inter_desc-FCDtril.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-100_hemi-LR_exc-inter_desc-FCtril.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-200_approach-median_mean001_desc-length.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-200_approach-median_mean001_desc-strength.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-400_approach-median_mean001_desc-length.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-400_approach-median_mean001_desc-strength.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-600_approach-median_mean001_desc-length.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM → cubnm-0.0.2/src/cubnm}/data/ctx_parc-schaefer-600_approach-median_mean001_desc-strength.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM.egg-info → cubnm-0.0.2/src/cubnm.egg-info}/dependency_links.txt +0 -0
- {cuBNM-0.0.1/src/cuBNM.egg-info → cubnm-0.0.2/src/cubnm.egg-info}/requires.txt +0 -0
cubnm-0.0.2/MANIFEST.in
ADDED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.0.
|
|
2
|
+
Name: cubnm
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: A toolbox for biophysical network modeling on GPUs
|
|
5
5
|
Author-email: Amin Saberi <amnsbr@gmail.com>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -52,29 +52,3 @@ Requires-Dist: scipy
|
|
|
52
52
|
Requires-Dist: pandas
|
|
53
53
|
Requires-Dist: pymoo==0.6
|
|
54
54
|
Requires-Dist: scikit-optimize==0.9
|
|
55
|
-
|
|
56
|
-
<div align="center">
|
|
57
|
-
<img src="./assets/logo_text.png" style="width:300px; margin:auto;">
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
The cuBNM toolbox performs efficient simulation and optimization of biophysical network models (BNM) of the brain on GPUs.
|
|
61
|
-
|
|
62
|
-
## Overview
|
|
63
|
-
The toolbox currently supports simulation of network nodes activity based on reduced Wong-Wang model with analytical-numerical feedback inhibition control. The Balloon-Windkessel model is used for calculation of simulated BOLD signals. It calculates goodness of fit of the simulated BOLD to the empirical BOLD based on functional connectivity (FC) and functional connectivity dynamics (FCD) matrices. The parameter optimization of the model can be done using grid search or evolutionary optimizers. Parallelization of the entire grid or each iteration of evolutionary optimizers is done at two levels: 1) simulations (across the GPU ‘blocks’), and 2) nodes (across each block’s ‘threads’). The toolbox additionally supports running the simulations on single- or multi-core CPUs, which will be used if no GPUs are detected or when requested by user (but the toolbox mainly focuses on GPUs).
|
|
64
|
-
|
|
65
|
-
This is a simplified flowchart of the different components of the program written in Python, C++ and CUDA.
|
|
66
|
-
|
|
67
|
-

|
|
68
|
-
|
|
69
|
-
## Installation
|
|
70
|
-
```
|
|
71
|
-
git clone https://github.com/amnsbr/cuBNM.git
|
|
72
|
-
cd cuBNM && pip install .
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Installation requires Python (tested with 3.9) and g++. Currently Windows, Mac and non-Nvidia GPUs are not supported.
|
|
76
|
-
|
|
77
|
-
[GSL](https://www.gnu.org/software/gsl/) is another requirement which will be installed by the package (in `~/.cuBNM/gsl`) but it takes a rather long time and is only done if `libgsl.a` and `libgslcblas.a` are not found in `"/usr/lib", "/lib", "/usr/local/lib", $LIBRARY_PATH, $LD_LIBRARY_PATH`. If you have GSL on your system but it is installed elsewhere, please add the `libgsl.a` and `libgslcblas.a` directories to `$LIBRARY_PATH`.
|
|
78
|
-
|
|
79
|
-
## Usage
|
|
80
|
-
In `./examples/examples.py` you can find some examples of running a single simulation (`run_sims`), grid search (`run_grid`) or CMAES optimization (`run_cmaes_optimizer`). More comprehensive documentations and examples will be added.
|
cubnm-0.0.2/README.rst
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
.. raw:: html
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/amnsbr/cubnm/main/docs/_static/logo_text.png" style="width:300px; margin:auto; padding-bottom:10px;" alt="cuBNM logo">
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
The cuBNM toolbox is designed for efficient biophysical network modeling of the brain on GPUs.
|
|
8
|
+
|
|
9
|
+
Overview
|
|
10
|
+
--------
|
|
11
|
+
The toolbox simulates neuronal activity of network nodes based on biophysical network modeling.
|
|
12
|
+
Currently two types of reduced Wong-Wang model based on
|
|
13
|
+
`Deco et al. 2014 <https://doi.org/10.1523/JNEUROSCI.5068-13.2014>`_ and
|
|
14
|
+
`Deco et al. 2013 <https://doi.org/10.1523/JNEUROSCI.1091-13.2013>`_ are implemented,
|
|
15
|
+
but the modular design of the code makes it possible to include additional models in the future.
|
|
16
|
+
The simulated activity of model neurons is fed into the Balloon-Windkessel model to calculate
|
|
17
|
+
simulated BOLD signal. GPU code is equipped with functions to calculate the functional connectivity
|
|
18
|
+
(FC) and functional connectivity dynamics (FCD) from the simulated BOLD signal, which can be
|
|
19
|
+
compared to FC and FCD matrices derived from empirical BOLD signals to assess similarity
|
|
20
|
+
(goodness-of-fit) of the simulated to empirical BOLD signal. The models
|
|
21
|
+
may include global or regional free parameters which are fit to the empirical data.
|
|
22
|
+
Regional parameters can be set to be homogeneous or can vary across nodes based on a
|
|
23
|
+
parameterized combination of fixed maps or using independent free parameters for each node
|
|
24
|
+
/ group of nodes.
|
|
25
|
+
|
|
26
|
+
Parameter optimization of the model can be performed via various optimization algorithms, including
|
|
27
|
+
grid (brute-force) search and evolutionary optimizers provided by the ``pymoo`` package.
|
|
28
|
+
Indepdendent simulations (i.e., within the grid or each iteration of the evolutionary optimizers)
|
|
29
|
+
are parallelized across the GPU "blocks" (one block per simualtion) and "threads" (one thread
|
|
30
|
+
per node).
|
|
31
|
+
|
|
32
|
+
The toolbox also supports running the simulations on single- or multi-core CPUs, which will
|
|
33
|
+
be used if no GPUs are detected or when requested by the user. However, the primary focus
|
|
34
|
+
of the toolbox is on GPU usage.
|
|
35
|
+
|
|
36
|
+
Below is a simplified flowchart of the different components of the program, which is
|
|
37
|
+
written in Python, C/C++, and CUDA:
|
|
38
|
+
|
|
39
|
+
.. image:: https://raw.githubusercontent.com/amnsbr/cubnm/main/docs/_static/flowchart_extended.png
|
|
40
|
+
:alt: Flowchart of the cuBNM program
|
|
41
|
+
|
|
42
|
+
.. overview-end
|
|
43
|
+
|
|
44
|
+
Documentation
|
|
45
|
+
-------------
|
|
46
|
+
Please find the documentation at https://cubnm.readthedocs.io.
|
|
47
|
+
|
|
48
|
+
.. install-start
|
|
49
|
+
|
|
50
|
+
Installation
|
|
51
|
+
------------
|
|
52
|
+
Using pip
|
|
53
|
+
~~~~~~~~~~~~
|
|
54
|
+
|
|
55
|
+
Requirements:
|
|
56
|
+
|
|
57
|
+
* Linux operating system on x86-64 architecture (for other architectures build from source)
|
|
58
|
+
* Python >= 3.7
|
|
59
|
+
|
|
60
|
+
Additional requirements for GPU functionality:
|
|
61
|
+
|
|
62
|
+
* NVIDIA GPU: In theory GPU devices with Compute Capability >= 2.x should be supported, but the code is not tested using devices with Compute Capability < 6.0.
|
|
63
|
+
* NVIDIA Driver >= 450.80.02
|
|
64
|
+
|
|
65
|
+
Install via:
|
|
66
|
+
|
|
67
|
+
.. code-block:: bash
|
|
68
|
+
|
|
69
|
+
pip install cubnm
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
From source
|
|
73
|
+
~~~~~~~~~~~~~~~~~
|
|
74
|
+
|
|
75
|
+
This might be needed in case prebuilt wheels are not available for your machine (e.g. on arm64 machines).
|
|
76
|
+
|
|
77
|
+
Requirements:
|
|
78
|
+
|
|
79
|
+
* Linux operating system
|
|
80
|
+
* Python >= 3.7
|
|
81
|
+
* GCC: Pre-built wheels were compiled using version 10.2.1 but alternative versions can be used.
|
|
82
|
+
* `GSL 2.7 <https://www.gnu.org/software/gsl/>`_: If GSL is not found (in ``"/usr/lib"``, ``"/lib"``, ``"/usr/local/lib"``, ``"~/miniconda/lib"``, ``$LIBRARY_PATH``, ``$LD_LIBRARY_PATH``) it will be installed and built by the package in ``~/.cubnm/gsl``, but this takes a rather long time (5+ minutes). If you have GSL 2.7 installed find the location of its libraries ``libgsl.a`` and ``libgslcblas.a`` and add the directory to ``$LIBRARY_PATH``. In this case note that GSL must have been built with ``--enable-shared`` option.
|
|
83
|
+
|
|
84
|
+
Additional requirements for GPU functionality:
|
|
85
|
+
|
|
86
|
+
* NVIDIA GPU: In theory GPU devices with Compute Capability >= 2.x should be supported, but the code is not tested using devices with Compute Capability < 6.0.
|
|
87
|
+
* CUDA Toolkit: Pre-built wheels were compiled using version 11.8 but alternative versions can be used.
|
|
88
|
+
|
|
89
|
+
The package can be installed from source using:
|
|
90
|
+
|
|
91
|
+
.. code-block:: bash
|
|
92
|
+
|
|
93
|
+
pip install git+https://github.com/amnsbr/cubnm.git -vvv
|
|
94
|
+
|
|
95
|
+
.. install-end
|
|
96
|
+
|
|
97
|
+
.. quickstart-start
|
|
98
|
+
|
|
99
|
+
Quickstart
|
|
100
|
+
-------------
|
|
101
|
+
Evolutionary optimization
|
|
102
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
103
|
+
Run a CMAES optimization of reduced Wong Wang model with G and wEE as free parameters:
|
|
104
|
+
|
|
105
|
+
.. code-block:: python
|
|
106
|
+
|
|
107
|
+
from cubnm import datasets, optimize
|
|
108
|
+
|
|
109
|
+
problem = optimize.BNMProblem(
|
|
110
|
+
model = 'rWW',
|
|
111
|
+
params = {
|
|
112
|
+
'G': (0.5, 2.5),
|
|
113
|
+
'wEE': (0.05, 0.75),
|
|
114
|
+
'wEI': 0.15,
|
|
115
|
+
},
|
|
116
|
+
emp_fc_tril = datasets.load_functional('FC', 'schaefer-100', exc_interhemispheric=True),
|
|
117
|
+
emp_fcd_tril = datasets.load_functional('FCD', 'schaefer-100', exc_interhemispheric=True),
|
|
118
|
+
duration = 60,
|
|
119
|
+
TR = 1,
|
|
120
|
+
sc_path = datasets.load_sc('strength', 'schaefer-100', return_path=True),
|
|
121
|
+
)
|
|
122
|
+
cmaes = optimize.CMAESOptimizer(popsize=20, n_iter=10, seed=1)
|
|
123
|
+
cmaes.setup_problem(problem)
|
|
124
|
+
cmaes.optimize()
|
|
125
|
+
|
|
126
|
+
Run a CMAES optimization of reduced Wong Wang model with G as a global free parameter and wEE and wEI as
|
|
127
|
+
regional free parameters that are regionally heterogeneous based on a weighted combination of two fixed
|
|
128
|
+
maps (HCP T1w/T2w, HCP FC G1):
|
|
129
|
+
|
|
130
|
+
.. code-block:: python
|
|
131
|
+
|
|
132
|
+
from cubnm import datasets, optimize
|
|
133
|
+
|
|
134
|
+
problem = optimize.BNMProblem(
|
|
135
|
+
model = 'rWW',
|
|
136
|
+
params = {
|
|
137
|
+
'G': (0.5, 2.5),
|
|
138
|
+
'wEE': (0.05, 0.75),
|
|
139
|
+
'wEI': (0.05, 0.75),
|
|
140
|
+
},
|
|
141
|
+
het_params = ['wEE', 'wEI'],
|
|
142
|
+
maps_path = datasets.load_maps('2maps', 'schaefer-100', norm='zscore', return_path=True),
|
|
143
|
+
emp_fc_tril = datasets.load_functional('FC', 'schaefer-100', exc_interhemispheric=True),
|
|
144
|
+
emp_fcd_tril = datasets.load_functional('FCD', 'schaefer-100', exc_interhemispheric=True),
|
|
145
|
+
duration = 60,
|
|
146
|
+
TR = 1,
|
|
147
|
+
sc_path = datasets.load_sc('strength', 'schaefer-100', return_path=True),
|
|
148
|
+
)
|
|
149
|
+
cmaes = optimize.CMAESOptimizer(popsize=30, n_iter=10, seed=1)
|
|
150
|
+
cmaes.setup_problem(problem)
|
|
151
|
+
cmaes.optimize()
|
|
152
|
+
|
|
153
|
+
Grid search
|
|
154
|
+
~~~~~~~~~~~
|
|
155
|
+
Run a 10x10 grid search of reduced Wong Wang model with G and wEE as free parameters:
|
|
156
|
+
|
|
157
|
+
.. code-block:: python
|
|
158
|
+
|
|
159
|
+
from cubnm import datasets, optimize
|
|
160
|
+
|
|
161
|
+
gs = optimize.GridSearch(
|
|
162
|
+
model = 'rWW',
|
|
163
|
+
params = {
|
|
164
|
+
'G': (0.5, 2.5, 10),
|
|
165
|
+
'wEE': (0.05, 0.75, 10),
|
|
166
|
+
'wEI': 0.21
|
|
167
|
+
},
|
|
168
|
+
duration = 60,
|
|
169
|
+
TR = 1,
|
|
170
|
+
sc_path = datasets.load_sc('strength', 'schaefer-100', return_path=True)
|
|
171
|
+
)
|
|
172
|
+
emp_fc_tril = datasets.load_functional('FC', 'schaefer-100', exc_interhemispheric=True)
|
|
173
|
+
emp_fcd_tril = datasets.load_functional('FCD', 'schaefer-100', exc_interhemispheric=True)
|
|
174
|
+
scores = gs.evaluate(emp_fc_tril, emp_fcd_tril)
|
|
175
|
+
|
|
176
|
+
.. quickstart-end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#ifndef BNM_CUH
|
|
2
|
+
#define BNM_CUH
|
|
3
|
+
#include "bnm.hpp"
|
|
4
|
+
__device__ void calculateGlobalInput(
|
|
5
|
+
u_real* tmp_globalinput, int* k_buff_idx,
|
|
6
|
+
int* nodes, int* sim_idx, int* j, int *k,
|
|
7
|
+
int* buff_idx, int* max_delay, u_real* _SC,
|
|
8
|
+
int** delay, bool* has_delay,
|
|
9
|
+
u_real** conn_state_var_hist, u_real* conn_state_var_1
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
template<typename Model>
|
|
13
|
+
__global__ void bnm(
|
|
14
|
+
Model* model,
|
|
15
|
+
u_real **BOLD,
|
|
16
|
+
u_real ***state_vars_out,
|
|
17
|
+
int **global_out_int,
|
|
18
|
+
bool **global_out_bool,
|
|
19
|
+
int n_vols_remove,
|
|
20
|
+
u_real *SC, u_real **global_params, u_real **regional_params,
|
|
21
|
+
u_real **conn_state_var_hist, int **delay, int max_delay,
|
|
22
|
+
int N_SIMS, int nodes, int BOLD_TR, int time_steps,
|
|
23
|
+
u_real *noise,
|
|
24
|
+
bool extended_output,
|
|
25
|
+
#ifdef NOISE_SEGMENT
|
|
26
|
+
int *shuffled_nodes, int *shuffled_ts,
|
|
27
|
+
int noise_time_steps, int noise_repeats,
|
|
28
|
+
#endif
|
|
29
|
+
int corr_len
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
#endif
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#ifndef BNM_HPP
|
|
2
|
+
#define BNM_HPP
|
|
3
|
+
template <typename Model>
|
|
4
|
+
void _run_simulations_cpu(
|
|
5
|
+
double * BOLD_ex_out, double * fc_trils_out, double * fcd_trils_out,
|
|
6
|
+
u_real ** global_params, u_real ** regional_params, u_real * v_list,
|
|
7
|
+
u_real * SC, u_real * SC_dist, BaseModel* m
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
template <typename Model>
|
|
11
|
+
void _init_cpu(BaseModel *m);
|
|
12
|
+
#endif
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Using floats vs doubles in the simulations, pass -D USE_FLOATS=1 to compiler to use floats
|
|
2
|
+
// Note that this does not affect FIC, CMAES and GOF calculations (always using doubles)
|
|
3
|
+
// as well as the noise array (always generated as floats, but then casted to u_real)
|
|
4
|
+
#ifdef USE_FLOATS
|
|
5
|
+
typedef float u_real;
|
|
6
|
+
#define EXP expf
|
|
7
|
+
#define POW powf
|
|
8
|
+
#define SQRT sqrtf
|
|
9
|
+
#define CUDA_MAX fmaxf
|
|
10
|
+
#define CUDA_MIN fminf
|
|
11
|
+
#else
|
|
12
|
+
typedef double u_real;
|
|
13
|
+
#define EXP exp
|
|
14
|
+
#define POW pow
|
|
15
|
+
#define SQRT sqrt
|
|
16
|
+
#define CUDA_MAX max
|
|
17
|
+
#define CUDA_MIN min
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
#ifndef MAX_NODES_REG
|
|
21
|
+
#define MAX_NODES_REG 200
|
|
22
|
+
#endif
|
|
23
|
+
#ifndef MAX_NODES_MANY
|
|
24
|
+
#define MAX_NODES_MANY 500
|
|
25
|
+
#endif
|
|
26
|
+
#ifndef MANY_NODES
|
|
27
|
+
#define MAX_NODES MAX_NODES_REG
|
|
28
|
+
#define __NOINLINE__
|
|
29
|
+
#else
|
|
30
|
+
#define MAX_NODES MAX_NODES_MANY
|
|
31
|
+
#define __NOINLINE__ __noinline__
|
|
32
|
+
// in this case some __device__ kernels will be __noinline__ to avoid
|
|
33
|
+
// using too much registers which would lead to
|
|
34
|
+
// "too many resources requested for launch"
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
#ifdef __CUDACC__
|
|
38
|
+
#define CUDA_CALLABLE_MEMBER __device__
|
|
39
|
+
#else
|
|
40
|
+
#define CUDA_CALLABLE_MEMBER
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#if defined(__CUDACC__) || defined(GPU_ENABLED)
|
|
44
|
+
#define _GPU_ENABLED
|
|
45
|
+
// this is used to determine if the GPU-related
|
|
46
|
+
// declarations should be done, either if
|
|
47
|
+
// nvcc is compiling the cuda source code
|
|
48
|
+
// or the C++ is being compiled but will be
|
|
49
|
+
// linked with the nvcc compiled library
|
|
50
|
+
// i.e., GPU_ENABLED is defined
|
|
51
|
+
#endif
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
__global__ void bold_stats(
|
|
2
|
+
u_real **mean_bold, u_real **ssd_bold,
|
|
3
|
+
u_real **BOLD, int N_SIMS, int nodes,
|
|
4
|
+
int bold_len, int corr_len, int n_vols_remove);
|
|
5
|
+
|
|
6
|
+
__global__ void window_bold_stats(
|
|
7
|
+
u_real **BOLD, int N_SIMS, int nodes,
|
|
8
|
+
int n_windows, int window_size_1, int *window_starts, int *window_ends,
|
|
9
|
+
u_real **windows_mean_bold, u_real **windows_ssd_bold);
|
|
10
|
+
|
|
11
|
+
__global__ void fc(u_real **fc_trils, u_real **windows_fc_trils,
|
|
12
|
+
u_real **BOLD, int N_SIMS, int nodes, int n_pairs, int *pairs_i,
|
|
13
|
+
int *pairs_j, int bold_len, int n_vols_remove,
|
|
14
|
+
int corr_len, u_real **mean_bold, u_real **ssd_bold,
|
|
15
|
+
int n_windows, int window_size_1, u_real **windows_mean_bold, u_real **windows_ssd_bold,
|
|
16
|
+
int *window_starts, int *window_ends,
|
|
17
|
+
int maxThreadsPerBlock);
|
|
18
|
+
|
|
19
|
+
__global__ void window_fc_stats(
|
|
20
|
+
u_real **windows_mean_fc, u_real **windows_ssd_fc,
|
|
21
|
+
u_real **L_windows_mean_fc, u_real **L_windows_ssd_fc,
|
|
22
|
+
u_real **R_windows_mean_fc, u_real **R_windows_ssd_fc,
|
|
23
|
+
u_real **windows_fc_trils, int N_SIMS, int n_windows, int n_pairs,
|
|
24
|
+
bool save_hemis, int n_pairs_hemi);
|
|
25
|
+
|
|
26
|
+
__global__ void fcd(
|
|
27
|
+
u_real **fcd_trils, u_real **L_fcd_trils, u_real **R_fcd_trils,
|
|
28
|
+
u_real **windows_fc_trils,
|
|
29
|
+
u_real **windows_mean_fc, u_real **windows_ssd_fc,
|
|
30
|
+
u_real **L_windows_mean_fc, u_real **L_windows_ssd_fc,
|
|
31
|
+
u_real **R_windows_mean_fc, u_real **R_windows_ssd_fc,
|
|
32
|
+
int N_SIMS, int n_pairs, int n_windows, int n_window_pairs,
|
|
33
|
+
int *window_pairs_i, int *window_pairs_j, int maxThreadsPerBlock,
|
|
34
|
+
bool save_hemis, int n_pairs_hemi);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#ifndef INCLUDES_CUH
|
|
2
|
+
#define INCLUDES_CUH
|
|
3
|
+
|
|
4
|
+
#include <stdio.h>
|
|
5
|
+
#include <stdlib.h>
|
|
6
|
+
#include <time.h>
|
|
7
|
+
#include <string.h>
|
|
8
|
+
#include <math.h>
|
|
9
|
+
#include <iostream>
|
|
10
|
+
#include <fstream>
|
|
11
|
+
#include <cmath>
|
|
12
|
+
#include <string>
|
|
13
|
+
#include <cstdlib>
|
|
14
|
+
#include <cuda_runtime.h>
|
|
15
|
+
#include <cooperative_groups.h>
|
|
16
|
+
#include <random>
|
|
17
|
+
#include <algorithm>
|
|
18
|
+
#include <map>
|
|
19
|
+
#include <gsl/gsl_matrix_double.h>
|
|
20
|
+
#include <gsl/gsl_vector_double.h>
|
|
21
|
+
#include <gsl/gsl_blas.h>
|
|
22
|
+
#include <gsl/gsl_math.h>
|
|
23
|
+
#include <gsl/gsl_errno.h>
|
|
24
|
+
#include <gsl/gsl_roots.h>
|
|
25
|
+
#include <thread>
|
|
26
|
+
#include <chrono>
|
|
27
|
+
#include <iomanip>
|
|
28
|
+
|
|
29
|
+
#endif
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
#ifndef BASE_HPP
|
|
2
|
+
#define BASE_HPP
|
|
3
|
+
#include "cubnm/models/bw.hpp" // will be used by all derived models
|
|
4
|
+
|
|
5
|
+
class BaseModel {
|
|
6
|
+
public:
|
|
7
|
+
BaseModel(
|
|
8
|
+
int nodes, int N_SIMS, int N_SCs, int BOLD_TR, int states_sampling,
|
|
9
|
+
int time_steps, bool do_delay, int window_size, int window_step, int rand_seed
|
|
10
|
+
) : nodes{nodes},
|
|
11
|
+
N_SIMS{N_SIMS},
|
|
12
|
+
N_SCs{N_SCs},
|
|
13
|
+
BOLD_TR{BOLD_TR},
|
|
14
|
+
states_sampling{states_sampling},
|
|
15
|
+
time_steps{time_steps},
|
|
16
|
+
do_delay{do_delay},
|
|
17
|
+
window_size{window_size},
|
|
18
|
+
window_step{window_step},
|
|
19
|
+
rand_seed{rand_seed}
|
|
20
|
+
{
|
|
21
|
+
set_bold_states_len();
|
|
22
|
+
};
|
|
23
|
+
// create virtual destructor and free
|
|
24
|
+
// the memory allocated for the arrays
|
|
25
|
+
virtual ~BaseModel() = default;
|
|
26
|
+
|
|
27
|
+
static constexpr char *name = "Base";
|
|
28
|
+
|
|
29
|
+
virtual void update(
|
|
30
|
+
int nodes, int N_SIMS, int N_SCs, int BOLD_TR, int states_sampling,
|
|
31
|
+
int time_steps, bool do_delay, int window_size, int window_step, int rand_seed
|
|
32
|
+
) {
|
|
33
|
+
this->nodes = nodes;
|
|
34
|
+
this->N_SIMS = N_SIMS;
|
|
35
|
+
this->N_SCs = N_SCs;
|
|
36
|
+
this->BOLD_TR = BOLD_TR;
|
|
37
|
+
this->states_sampling = states_sampling;
|
|
38
|
+
this->time_steps = time_steps;
|
|
39
|
+
this->do_delay = do_delay;
|
|
40
|
+
this->window_size = window_size;
|
|
41
|
+
this->window_step = window_step;
|
|
42
|
+
this->rand_seed = rand_seed;
|
|
43
|
+
this->set_bold_states_len();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
virtual void set_bold_states_len() {
|
|
47
|
+
// bold samples (volumes) length
|
|
48
|
+
// and total matrix size
|
|
49
|
+
bold_len = time_steps / BOLD_TR;
|
|
50
|
+
bold_size = bold_len * nodes;
|
|
51
|
+
// states samples length and
|
|
52
|
+
// total matrix size
|
|
53
|
+
states_len = time_steps / states_sampling;
|
|
54
|
+
states_size = states_len * nodes;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
virtual void free_cpu();
|
|
58
|
+
|
|
59
|
+
int nodes{}, N_SIMS{}, N_SCs{}, BOLD_TR{}, states_sampling{}, time_steps{},
|
|
60
|
+
window_size{}, window_step{}, rand_seed{}, n_pairs{}, n_windows{},
|
|
61
|
+
n_window_pairs{}, bold_len{}, bold_size{}, states_len{}, states_size{},
|
|
62
|
+
n_vols_remove{}, n_states_samples_remove{}, corr_len{},
|
|
63
|
+
noise_size{}, noise_repeats{},
|
|
64
|
+
last_nodes{0}, last_time_steps{0}, last_rand_seed{0},
|
|
65
|
+
last_noise_time_steps{0};
|
|
66
|
+
// TODO: make some short or size_t
|
|
67
|
+
bool cpu_initialized{false}, modifies_params{false}, do_delay{};
|
|
68
|
+
|
|
69
|
+
#ifdef _GPU_ENABLED
|
|
70
|
+
virtual void free_gpu();
|
|
71
|
+
bool gpu_initialized{false};
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
u_real ***states_out;
|
|
75
|
+
u_real *noise;
|
|
76
|
+
int **global_out_int;
|
|
77
|
+
bool **global_out_bool;
|
|
78
|
+
int *window_starts, *window_ends;
|
|
79
|
+
#ifdef NOISE_SEGMENT
|
|
80
|
+
int *shuffled_nodes, *shuffled_ts;
|
|
81
|
+
#endif
|
|
82
|
+
#ifdef _GPU_ENABLED
|
|
83
|
+
u_real **BOLD, **mean_bold, **ssd_bold, **fc_trils, **windows_mean_bold, **windows_ssd_bold,
|
|
84
|
+
**windows_fc_trils, **windows_mean_fc, **windows_ssd_fc, **fcd_trils,
|
|
85
|
+
**d_SC, **d_global_params, **d_regional_params;
|
|
86
|
+
double **d_fc_trils, **d_fcd_trils;
|
|
87
|
+
int *pairs_i, *pairs_j, *window_pairs_i, *window_pairs_j, *d_SC_indices;
|
|
88
|
+
#endif
|
|
89
|
+
|
|
90
|
+
struct Config {
|
|
91
|
+
int bold_remove_s{30};
|
|
92
|
+
bool exc_interhemispheric{true};
|
|
93
|
+
bool drop_edges{true};
|
|
94
|
+
bool sync_msec{false};
|
|
95
|
+
bool ext_out{true};
|
|
96
|
+
bool states_ts{false};
|
|
97
|
+
// set a default length of noise segment (msec)
|
|
98
|
+
int noise_time_steps{30000};
|
|
99
|
+
bool verbose{false}; // print simulation info + progress
|
|
100
|
+
int progress_interval{500}; // msec; interval for updating progress
|
|
101
|
+
bool serial{false};
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
Config base_conf;
|
|
105
|
+
|
|
106
|
+
void print_config() {
|
|
107
|
+
std::cout << "nodes: " << nodes << std::endl;
|
|
108
|
+
std::cout << "N_SIMS: " << N_SIMS << std::endl;
|
|
109
|
+
std::cout << "N_SCs: " << N_SCs << std::endl;
|
|
110
|
+
std::cout << "BOLD_TR: " << BOLD_TR << std::endl;
|
|
111
|
+
std::cout << "states_sampling: " << states_sampling << std::endl;
|
|
112
|
+
std::cout << "time_steps: " << time_steps << std::endl;
|
|
113
|
+
std::cout << "do_delay: " << do_delay << std::endl;
|
|
114
|
+
std::cout << "window_size: " << window_size << std::endl;
|
|
115
|
+
std::cout << "window_step: " << window_step << std::endl;
|
|
116
|
+
std::cout << "rand_seed: " << rand_seed << std::endl;
|
|
117
|
+
std::cout << "exc_interhemispheric: " << base_conf.exc_interhemispheric << std::endl;
|
|
118
|
+
std::cout << "sync_msec: " << base_conf.sync_msec << std::endl;
|
|
119
|
+
std::cout << "verbose: " << base_conf.verbose << std::endl;
|
|
120
|
+
std::cout << "progress_interval: " << base_conf.progress_interval << std::endl;
|
|
121
|
+
std::cout << "bold_remove_s: " << base_conf.bold_remove_s << std::endl;
|
|
122
|
+
std::cout << "drop_edges: " << base_conf.drop_edges << std::endl;
|
|
123
|
+
std::cout << "noise_time_steps: " << base_conf.noise_time_steps << std::endl;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
virtual void set_conf(std::map<std::string, std::string> config_map) {
|
|
127
|
+
set_base_conf(config_map);
|
|
128
|
+
}
|
|
129
|
+
#ifdef _GPU_ENABLED
|
|
130
|
+
virtual void init_gpu(BWConstants bwc) = 0;
|
|
131
|
+
virtual void run_simulations_gpu(
|
|
132
|
+
double * BOLD_ex_out, double * fc_trils_out, double * fcd_trils_out,
|
|
133
|
+
u_real ** global_params, u_real ** regional_params, u_real * v_list,
|
|
134
|
+
u_real ** SC, int * SC_indices, u_real * SC_dist) = 0;
|
|
135
|
+
#endif
|
|
136
|
+
virtual void init_cpu() = 0;
|
|
137
|
+
virtual void run_simulations_cpu(
|
|
138
|
+
double * BOLD_ex_out, double * fc_trils_out, double * fcd_trils_out,
|
|
139
|
+
u_real ** global_params, u_real ** regional_params, u_real * v_list,
|
|
140
|
+
u_real ** SC, int * SC_indices, u_real * SC_dist) = 0;
|
|
141
|
+
virtual void prep_params(u_real ** global_params, u_real ** regional_params, u_real * v_list,
|
|
142
|
+
u_real ** SC, int * SC_indices, u_real * SC_dist,
|
|
143
|
+
bool ** global_out_bool, int ** global_out_int) {};
|
|
144
|
+
// use if additional modification of parameters is needed (e.g. FIC in rWW)
|
|
145
|
+
// declare getters for some of static variables
|
|
146
|
+
// note that as these variables must be static
|
|
147
|
+
// and known at compile time, we cannot define
|
|
148
|
+
// the implementation in the base class
|
|
149
|
+
// the only solution I could think of was to
|
|
150
|
+
// define the (same) implementation in all
|
|
151
|
+
// derived models to make sure they return
|
|
152
|
+
// the static member of that particular model
|
|
153
|
+
// TODO: see if there is a better solution
|
|
154
|
+
virtual int get_n_state_vars() = 0;
|
|
155
|
+
virtual int get_n_global_out_bool() = 0;
|
|
156
|
+
virtual int get_n_global_out_int() = 0;
|
|
157
|
+
virtual int get_n_global_params() = 0;
|
|
158
|
+
virtual int get_n_regional_params() = 0;
|
|
159
|
+
virtual char * get_name() {
|
|
160
|
+
return name;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
virtual void h_init(
|
|
164
|
+
u_real* _state_vars, u_real* _intermediate_vars,
|
|
165
|
+
int* _ext_int, bool* _ext_bool,
|
|
166
|
+
int* _ext_int_shared, bool* _ext_bool_shared
|
|
167
|
+
) = 0;
|
|
168
|
+
virtual void h_step(
|
|
169
|
+
u_real* _state_vars, u_real* _intermediate_vars,
|
|
170
|
+
u_real* _global_params, u_real* _regional_params,
|
|
171
|
+
u_real& tmp_globalinput,
|
|
172
|
+
u_real* noise, long& noise_idx
|
|
173
|
+
) = 0;
|
|
174
|
+
virtual void _j_post_bw_step(
|
|
175
|
+
u_real* _state_vars, u_real* _intermediate_vars,
|
|
176
|
+
int* _ext_int, bool* _ext_bool,
|
|
177
|
+
int* _ext_int_shared, bool* _ext_bool_shared,
|
|
178
|
+
bool& restart,
|
|
179
|
+
u_real* _global_params, u_real* _regional_params,
|
|
180
|
+
int& ts_bold
|
|
181
|
+
) {};
|
|
182
|
+
virtual void h_post_bw_step(
|
|
183
|
+
u_real** _state_vars, u_real** _intermediate_vars,
|
|
184
|
+
int** _ext_int, bool** _ext_bool,
|
|
185
|
+
int* _ext_int_shared, bool* _ext_bool_shared,
|
|
186
|
+
bool& restart,
|
|
187
|
+
u_real* _global_params, u_real** _regional_params,
|
|
188
|
+
int& ts_bold
|
|
189
|
+
) {
|
|
190
|
+
for (int j=0; j<this->nodes; j++) {
|
|
191
|
+
bool j_restart = false;
|
|
192
|
+
_j_post_bw_step(
|
|
193
|
+
_state_vars[j], _intermediate_vars[j],
|
|
194
|
+
_ext_int[j], _ext_bool[j],
|
|
195
|
+
_ext_int_shared, _ext_bool_shared,
|
|
196
|
+
j_restart,
|
|
197
|
+
_global_params, _regional_params[j],
|
|
198
|
+
ts_bold
|
|
199
|
+
);
|
|
200
|
+
// restart if any node needs to restart
|
|
201
|
+
restart = restart || j_restart;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
virtual void _j_restart(
|
|
205
|
+
u_real* _state_vars, u_real* _intermediate_vars,
|
|
206
|
+
int* _ext_int, bool* _ext_bool,
|
|
207
|
+
int* _ext_int_shared, bool* _ext_bool_shared
|
|
208
|
+
) {};
|
|
209
|
+
virtual void h_restart(
|
|
210
|
+
u_real** _state_vars, u_real** _intermediate_vars,
|
|
211
|
+
int** _ext_int, bool** _ext_bool,
|
|
212
|
+
int* _ext_int_shared, bool* _ext_bool_shared
|
|
213
|
+
) {
|
|
214
|
+
for (int j=0; j<this->nodes; j++) {
|
|
215
|
+
_j_restart(
|
|
216
|
+
_state_vars[j], _intermediate_vars[j],
|
|
217
|
+
_ext_int[j], _ext_bool[j],
|
|
218
|
+
_ext_int_shared, _ext_bool_shared
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
virtual void h_post_integration(
|
|
223
|
+
u_real ***state_vars_out,
|
|
224
|
+
int **global_out_int, bool **global_out_bool,
|
|
225
|
+
u_real* _state_vars, u_real* _intermediate_vars,
|
|
226
|
+
int* _ext_int, bool* _ext_bool,
|
|
227
|
+
int* _ext_int_shared, bool* _ext_bool_shared,
|
|
228
|
+
u_real** global_params, u_real** regional_params,
|
|
229
|
+
u_real* _global_params, u_real* _regional_params,
|
|
230
|
+
int& sim_idx, const int& nodes, int& j
|
|
231
|
+
) {};
|
|
232
|
+
|
|
233
|
+
// In addition to the above, each derived model
|
|
234
|
+
// must also define the following __device__
|
|
235
|
+
// kernels. Note that it is not possible to declare
|
|
236
|
+
// them virtual, as CUDA does not work very well
|
|
237
|
+
// with virtual functions: `init`, `step`, `post_bw_step`,
|
|
238
|
+
// `restart`, `post_integration`. For their arguments see rww.hpp
|
|
239
|
+
|
|
240
|
+
virtual gsl_vector * calculate_fc_tril(gsl_matrix * bold);
|
|
241
|
+
virtual gsl_vector * calculate_fcd_tril(gsl_matrix * bold, int * window_starts, int * window_ends);
|
|
242
|
+
|
|
243
|
+
protected:
|
|
244
|
+
void set_base_conf(std::map<std::string, std::string> config_map) {
|
|
245
|
+
// Note: some of the base_conf members (ext_out, states_ts)
|
|
246
|
+
// are set directly based on arguments passed from Python
|
|
247
|
+
for (const auto& pair : config_map) {
|
|
248
|
+
if (pair.first == "exc_interhemispheric") {
|
|
249
|
+
this->base_conf.exc_interhemispheric = (bool)std::stoi(pair.second);
|
|
250
|
+
} else if (pair.first == "sync_msec") {
|
|
251
|
+
this->base_conf.sync_msec = (bool)std::stoi(pair.second);
|
|
252
|
+
} else if (pair.first == "verbose") {
|
|
253
|
+
this->base_conf.verbose = (bool)std::stoi(pair.second);
|
|
254
|
+
} else if (pair.first == "bold_remove_s") {
|
|
255
|
+
this->base_conf.bold_remove_s = std::stoi(pair.second);
|
|
256
|
+
} else if (pair.first == "drop_edges") {
|
|
257
|
+
this->base_conf.drop_edges = (bool)std::stoi(pair.second);
|
|
258
|
+
} else if (pair.first == "noise_time_steps") {
|
|
259
|
+
this->base_conf.noise_time_steps = std::stoi(pair.second);
|
|
260
|
+
} else if (pair.first == "progress_interval") {
|
|
261
|
+
this->base_conf.progress_interval = std::stoi(pair.second);
|
|
262
|
+
} else if (pair.first == "serial") {
|
|
263
|
+
this->base_conf.serial = (bool)std::stoi(pair.second);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// following templates will be used by each derived model
|
|
270
|
+
#ifdef _GPU_ENABLED
|
|
271
|
+
template<typename Model>
|
|
272
|
+
extern void _run_simulations_gpu(
|
|
273
|
+
double * BOLD_out, double * fc_trils_out, double * fcd_trils_out,
|
|
274
|
+
u_real ** global_params, u_real ** regional_params, u_real * v_list,
|
|
275
|
+
u_real ** SC, int * SC_indices, u_real * SC_dist, BaseModel *model
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
template<typename Model>
|
|
279
|
+
extern void _init_gpu(BaseModel *model, BWConstants bwc);
|
|
280
|
+
#endif
|
|
281
|
+
|
|
282
|
+
template <typename Model>
|
|
283
|
+
void _run_simulations_cpu(
|
|
284
|
+
double * BOLD_ex_out, double * fc_trils_out, double * fcd_trils_out,
|
|
285
|
+
u_real ** global_params, u_real ** regional_params, u_real * v_list,
|
|
286
|
+
u_real ** SC, int * SC_indices, u_real * SC_dist, BaseModel* m
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
template <typename Model>
|
|
290
|
+
void _init_cpu(BaseModel *m);
|
|
291
|
+
#endif
|