Giter Site home page Giter Site logo

rsachetto / monoalg3d_c Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 12.0 134.93 MB

Extensible Monodomain simulator

License: MIT License

C 84.65% Cuda 9.08% MATLAB 0.01% Awk 0.05% Shell 1.45% C++ 2.56% Python 1.44% Makefile 0.48% CMake 0.07% GLSL 0.05% Pawn 0.17%
cuda-libraries hearth medicine simluation

monoalg3d_c's Introduction

Top Langs GitHub stats

monoalg3d_c's People

Contributors

bergolho avatar elnazp avatar jennyhelyanwe avatar juliacamps avatar rsachetto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

monoalg3d_c's Issues

Problems with the new GPU double precision

Hello Sachetto,

When I tried to update my repository to the latest version with the GPU double precision I was not able to compile the Bondarenko model. I started to receive the following error:

~/Github/MonoAlg3D_C/src/models_library/bondarenko/bondarenko_2004_GPU.cu(266): error: calling a host function("std::pow<double, float> ") from a device function("RHS_gpu") is not allowed

~/Github/MonoAlg3D_C/src/models_library/bondarenko/bondarenko_2004_GPU.cu(266): error: identifier "std::pow<double, float> " is undefined in device code

In order to solve this issue, I checked the 'build.sh' file and commented the CFLAGS for the double precision. After this change, I was able to build everything. Although, when I tried to run the "purkinje_with_fibrosis.ini" example I received several warnings with the message:

Solving EDO 1 times before solving PDE
Starting simulation
t = 0.00000, Iterations = 6, Error Norm = 2.642679e-17, Number of Tissue Cells:132322, Tissue CG Iterations time: 6207 us
            , Iterations = 12, Error Norm = 4.517128e-17, Number of Purkinje Cells:582, Purkinje CG Iterations time: 642 us, Total Iteration time: 485641 us
Accepting solution with error > 1.021493 
Accepting solution with error > 1.059086 
Accepting solution with error > 1.100347 
Accepting solution with error > 1.142385 
Accepting solution with error > 1.188148 
Accepting solution with error > 1.237055 

Then after some iterations the solver returned NaN for the Purkinje solution.

t = 130.00000, Iterations = 10, Error Norm = 1.558992e-17, Number of Tissue Cells:132322, Tissue CG Iterations time: 7125 us
            , Iterations = 12, Error Norm = 6.437341e-17, Number of Purkinje Cells:582, Purkinje CG Iterations time: 717 us, Total Iteration time: 389427 us
t = 132.00000, Iterations = 10, Error Norm = 1.469444e-17, Number of Tissue Cells:132322, Tissue CG Iterations time: 6988 us
            , Iterations = 0, Error Norm = nan, Number of Purkinje Cells:582, Purkinje CG Iterations time: 97 us, Total Iteration time: 385947 us
t = 134.00000, Iterations = 10, Error Norm = 1.300754e-17, Number of Tissue Cells:132322, Tissue CG Iterations time: 7097 us
            , Iterations = 0, Error Norm = nan, Number of Purkinje Cells:582, Purkinje CG Iterations time: 96 us, Total Iteration time: 394784 us
t = 136.00000, Iterations = 10, Error Norm = 1.414033e-17, Number of Tissue Cells:132322, Tissue CG Iterations time: 7262 us
            , Iterations = 0, Error Norm = nan, Number of Purkinje Cells:582, Purkinje CG Iterations time: 91 us, Total Iteration time: 384568 us
t = 138.00000, Iterations = 10, Error Norm = 1.212957e-17, Number of Tissue Cells:132322, Tissue CG Iterations time: 7005 us
            , Iterations = 0, Error Norm = nan, Number of Purkinje Cells:582, Purkinje CG Iterations time: 89 us, Total Iteration time: 379773 us

I don't know if this is an error in my version of CUDA or if I need to include something new to the Purkinje cellular models, because I see that are some changes in the structure of the cellular models from now on. Can you help me with this problem ?

Problem on the "restore_state" module

Hello Sachetto,

I am trying to run a spiral wave simulation by following the S1-S2 protocol and I divided the simulation in two steps.

First of all, I run a prepacing simulation where I will be saving the state of the simulation after I got a sustained spiral wave by using the [save_state] module.

Secondly, I run another simulation loading the state of the previous one, but the problem is that there is a memory leak on the 'restore_simulation_state' function and I need to quickly kill the process before my machine crashes ...

I am sending you the two configuration files that I used, the prepacing and restored one.

[]'s
Lucas

elnaz_plain_mesh_tentusscher_spiral.zip

Incorrect Stimulus Loaded

Hi! Sorry for another question!

When executing the batch script, all iterations other than the first one only contains the last stimulus:

Stimulus name: stim_plain
[stim] configuration:
[stim] library = ./shared_libs/libdefault_stimuli.so
[stim] main function = stim_if_x_less_than
[stim] start = 1801.000000
[stim] duration = 2.0
[stim] period = 450
[stim] current = -50.0
[stim] x_limit = 2000.0

Only the first iteration managed to load the stimulus with the correct start time:

Stimulus name: stim_plain
[stim] configuration:
[stim] library = ./shared_libs/libdefault_stimuli.so
[stim] main function = stim_if_x_less_than
[stim] start = 1.0
[stim] duration = 2.0
[stim] period = 450
[stim] current = -50.0
[stim] x_limit = 2000.0

The configuration file is as follows:
cable.ini

[main]
num_threads=4
dt_pde=0.04     ; delta time for the PDE (monodomain equation)
simulation_time=2000.0
abort_on_no_activity=false
use_adaptivity=false

[update_monodomain]
main_function=update_monodomain_default

[save_result]
print_rate=100
mesh_print_rate=100
mesh_format=ensight
output_dir=./outputs/cable

init_function=init_save_with_activation_times
end_function=end_save_with_activation_times
main_function=save_with_activation_times
time_threshold=0.0
apd_threshold=-65.0
save_visible_mask=false
remove_older_simulation=true
binary=false

[assembly_matrix]
init_function=set_initial_conditions_fvm
sigma_x=0.00022 	; conductivities in every direction, in S/mm
sigma_y=0.00022
sigma_z=0.00022
library_file=shared_libs/libdefault_matrix_assembly.so
main_function=homogeneous_sigma_assembly_matrix

[linear_system_solver]
tolerance=1e-16
use_preconditioner=no
max_iterations=500
library_file=shared_libs/libdefault_linear_system_solver.so
use_gpu=yes
main_function=conjugate_gradient
init_function=init_conjugate_gradient
end_function=end_conjugate_gradient

[domain]
name=1D mesh
start_dx=400.0	; the mesh is discretised as cubes (all dimensions are the same size) and the cube size is 100 um (0.1 mm)
start_dy=400.0	
start_dz=400.0
cable_length=120000.0 ; 120000 um, which is 12 cm
main_function=initialize_grid_with_cable_mesh

[ode_solver]
adaptive=false
dt=0.02 	; delta time for the ODE (cell model)
use_gpu=no
gpu_id=0
library_file= ./shared_libs/libToRORd_fkatp_mixed_endo_mid_epi.so

[stim_plain]
start = 1.0
duration = 2.0
period = 450
current = -50.0
x_limit = 2000.0 ; this means that the 10 first cells were paced by us
main_function=stim_if_x_less_than

[extra_data]
INa_Multiplier=0.2
main_function=set_extra_data_mixed_torord_fkatp_epi_mid_endo

The batch configuration file:

[batch]
initial_config=../cable/cable.ini
output_folder=batch_simulations
num_simulations_per_parameter_change=1

[modify]
;section|parameter=(range or list)|start|end|increment (including start and end)
extra_data|INa_Multiplier=range|0.25|1.0|0.05

Error on new "matrix_assembly" function

Hello Sachetto,

I just got this new version of the solver in order to test new features and when I was compiling on my Fedora machine I found an error in the "matrix_assembly.c" file on line 129.

n = get_cell_neighbour_as_void(cell, cell->y_top->x_right, &cell_type);
if(n) num_not_null++;
arrput(*neighbours, (struct basic_cell_data *)n);

The following error message:
/home/berg/MonoAlg3D_C/src/matrix_assembly_library/matrix_assembly.c:129:52: error: request for member ‘x_right’ in something not a structure or union

Correções e sugestões

Oi Sachetto,

Estou ajudando o Pedro Arroyo a começar a utilizar seu código, porém quando clonamos a última versão do repositório e começamos a testar todos os exemplos da pasta 'example_configs' nos deparamos com alguns erros.

Abaixo vou descrever pra você os erros que aparecem quando se executa cada um destes arquivos.

benchmark_config_example.ini:
Error making the output directory.

Parece que existe uma pasta 'outputs' no seu repositório local que não subiu para o Github.

cable_mesh_with_tt2006.ini:
OK

cubic_mesh_with_fibrosis_example.ini:
GPU Error!: invalid configuration argument at
/home/berg/Github/Sachetto/MonoAlg3D_C/src/models_library/ten_tusscher_3_RS_GPU.cu 22

Acho que o erro está quando se configura a 'fibrose' no modelo do TenTusscher3.

cuboid_ohara.ini
Error making the output directory.

Mesmo erro que ocorre no "benchmark_config_example.ini"

cuboid_tentusscher4.ini
A simulação rodou perfeitamente, porém o Paraview não conseguiu carregar os arquivos.
Olhei o nome dos arquivos de saída e verifiquei que tem aspas duplas adicionais.
O nome dos arquivos está saindo assim: "V_t_"_it_0_ms.vtu
Acho que o erro está na função "save_as_vtk" na parte de colocar o "file_prefix".

fhn_random_conductivities_2D.ini
OK

human_big_scar_wedge_with_fibrosis.ini
Está faltando a malha "human_800_scars_tagged.alg".

human_mesh_no_fibrosis_config_example.ini
Está faltando a malha "human_800.alg" e o arquivo "stim.pts".

human_mesh_with_fibrosis_config_example.ini
Está faltando a malha "human_800_scars_tagged.alg" e o arquivo "stim.pts".

human_mesh_with_two_scars_and_fibrosis_from_file.ini
Está faltando a malha "human_800_scars_tagged.alg", o arquivo "stim.pts" e os arquivos de configuração da cicatriz "big_scar.pts", "small_scar_2.pts".

human_small_scar_wedge_with_fibrosis.ini
Está faltando a malha "human_800_scars_tagged.alg".

mouse_mesh_config_example.ini
Está faltando a malha "mouse.alg".

mouse_mesh_spiral_config_example.ini
Está faltando a malha "mouse.alg".

plain_mesh_no_fibrosis_example.ini
'initialize_grid_with_square_mesh' function not found in the provided domain library.

plain_mesh_with_fibrosis_and_border_zone_inside_circle_example.ini
Invalid name use_preconditioner in section main on the config file!

plain_mesh_with_fibrosis.ini
Mesmo erro do 'cubic_mesh_with_fibrosis_example.ini'.

rabbit_mesh_config_example.ini
Consome muita memória, vou testar no cluster.

Além disso, notei que novas funcionalidades foram adicionadas, como por exemplo a inclusão de Checkpoints para salvar o estado das simulações. Acho que seria interessante adicionar alguns exemplos que demonstram esta funcionalidade.

Outra coisa, acho bom dar uma melhorada no "README.md" colocando os pré-requisitos pra dar build no projeto. Por exemplo, para configurar esta última versão do repositório na minha máquina aqui tive que instalar o GCC 5.3.0 e usar ele no caminho padrão na hora de chamar o CMake. Senão fizesse isso dava erro na hora de compilar os arquivos ".cu". Fora isso tive que instalar dois pacotes do GTK para funcionar no Fedora 28: "gtk3-devel" e "gtksourceview3-devel".

[]'s
Lucas

Segmentation fault

Hello Sachetto,

After the commit ("gui_config is not global anymore") all the simulations are returning Segmentation fault, even the ones that do not consider Purkinje fibers.

Batch config does not execute

Hi!

I'm trying to execute the batch_cable_config.ini provided in the example configurations using the command:

./bin/MonoAlg3D -c example_configs/batch_cable_config.ini

This resulted in the following errors:

Invalid name initial_config in section batch on the config file!
Invalid name output_folder in section batch on the config file!
Invalid name num_simulations_per_parameter_change in section batch on the config file!
Invalid name extra_data|atpi in section modify on the config file!
Invalid name extra_data|Ko in section modify on the config file!
Invalid name extra_data|GNa_multiplicator in section modify on the config file!
Invalid name extra_data|GCaL_multiplicator in section modify on the config file!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.