Commit 479ed9f1 authored by gsaxena's avatar gsaxena
Browse files

This commit takes care of "multiple printing" problem

(1) Parallel versions of 3 functions in PhysiCell_settings.cpp were written ONLY to control std::cout using IOProcessor(world)
(2) display_simulation_status(...) in PhysiCell_various_outputs.cpp has now a parallel version which controls printing using IOProcessor(world) but we needed an MPI_Reduce() to calculate the total number of cells i.e. MPI_SUM on root process.
(3) Improved a small printing in DistPhy_Utils.cpp - the initial number of cells in each process.
(4) Now calling the display_simulation_status(std::cout, world, cart_topo) in the main.cpp of TNF example.
(5) Commented out a "Processing default ..." std::cout in initialize_cell_definitions_from_pugixml(...) in PhysiCell_cell.cpp.
parent ce105e26
......@@ -75,7 +75,7 @@ namespace DistPhy
int root = 0;
MPI_Scatter(&cp.no_of_IDs_all_procs[0], send_count, MPI_INT, &mc.my_no_of_cell_IDs, recv_count, MPI_INT, root, cart_topo.mpi_cart_comm);
std::cout<<"Rank="<<world.rank<<"No of cells="<<mc.my_no_of_cell_IDs<<std::endl;
std::cout<<"MPI Rank = "<<world.rank<<" No of cells = "<<mc.my_no_of_cell_IDs<<std::endl;
/*--------------------------------------------------------------------------------------------------------------*/
/* Now resize the vectors inside mpi_MyCells on each process according to the no. of IDs that they will receive */
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
###############################################################################
# If you use PhysiCell in your project, please cite PhysiCell and the version #
# number, such as below: #
# #
# We implemented and solved the model using PhysiCell (Version x.y.z) [1]. #
# #
# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, #
# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- #
# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 #
# DOI: 10.1371/journal.pcbi.1005991 #
# #
# See VERSION.txt or call get_PhysiCell_version() to get the current version #
# x.y.z. Call display_citations() to get detailed information on all cite-#
# able software used in your PhysiCell application. #
# #
# Because PhysiCell extensively uses BioFVM, we suggest you also cite BioFVM #
# as below: #
# #
# We implemented and solved the model using PhysiCell (Version x.y.z) [1], #
# with BioFVM [2] to solve the transport equations. #
# #
# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, #
# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- #
# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 #
# DOI: 10.1371/journal.pcbi.1005991 #
# #
# [2] A Ghaffarizadeh, SH Friedman, and P Macklin, BioFVM: an efficient para- #
# llelized diffusive transport solver for 3-D biological simulations, #
# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 #
# #
###############################################################################
# #
# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
# #
# Copyright (c) 2015-2018, Paul Macklin and the PhysiCell Project #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, #
# this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its #
# contributors may be used to endorse or promote products derived from this #
# software without specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" #
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE #
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE #
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE #
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR #
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF #
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS #
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN #
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) #
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
# POSSIBILITY OF SUCH DAMAGE. #
# #
###############################################################################
*/
-->
<!--
<user_details />
-->
<PhysiCell_settings version="devel-version">
<domain>
<x_min>-300</x_min>
<x_max>300</x_max>
<y_min>-300</y_min>
<y_max>300</y_max>
<z_min>-300</z_min>
<z_max>300</z_max>
<dx>20</dx>
<dy>20</dy>
<dz>20</dz>
<use_2D>false</use_2D>
</domain>
<overall>
<max_time units="min">1600</max_time>
<time_units>min</time_units>
<space_units>micron</space_units>
<dt_diffusion units="min">0.02</dt_diffusion>
<dt_mechanics units="min">0.1</dt_mechanics>
<dt_phenotype units="min">2</dt_phenotype>
</overall>
<parallel>
<omp_num_threads>48</omp_num_threads>
</parallel>
<save>
<folder>output</folder> <!-- use . for root -->
<full_data>
<interval units="min">30</interval>
<enable>true</enable>
</full_data>
<SVG>
<interval units="min">100</interval>
<enable>true</enable>
</SVG>
<legacy_data>
<enable>true</enable>
</legacy_data>
</save>
<microenvironment_setup>
<variable name="oxygen" units="mmHg" ID="0">
<physical_parameter_set>
<diffusion_coefficient units="micron^2/min">100000.0</diffusion_coefficient>
<decay_rate units="1/min">.1</decay_rate>
</physical_parameter_set>
<initial_condition units="mmHg">38.0</initial_condition>
<Dirichlet_boundary_condition units="mmHg" enabled="true">38.0</Dirichlet_boundary_condition>
</variable>
<variable name="tnf" units="TNF/um^3" ID="1">
<physical_parameter_set>
<diffusion_coefficient units="micron^2/min">1200.0</diffusion_coefficient>
<decay_rate units="1/min">.0275</decay_rate>
</physical_parameter_set>
<initial_condition units="molecules/voxel">0.0</initial_condition>
<Dirichlet_boundary_condition units="molecules/voxel" enabled="false">0.0</Dirichlet_boundary_condition>
</variable>
<options>
<calculate_gradients>true</calculate_gradients>
<track_internalized_substrates_in_each_agent>true</track_internalized_substrates_in_each_agent>
<!-- not yet supported -->
<initial_condition type="matlab" enabled="false">
<filename>./config/initial.mat</filename>
</initial_condition>
<!-- not yet supported -->
<dirichlet_nodes type="matlab" enabled="false">
<filename>./config/dirichlet.mat</filename>
</dirichlet_nodes>
</options>
</microenvironment_setup>
<cell_definitions>
<cell_definition name="default" ID="0">
<phenotype>
<cycle code="5" name="live_cells_cycle_model">
<!-- using higher than normal significant digits to match divisions in default code -->
<phase_transition_rates units="1/min">
<!-- Cycle duration -->
<rate start_index="0" end_index="0" fixed_duration="false">0.00075</rate>
</phase_transition_rates>
</cycle>
<death>
<model code="100" name="apoptosis">
<death_rate units="1/min">5.31667e-05</death_rate> <!-- Original value 5.31667e-05 -->
<phase_durations units="min">
<duration index="0" fixed_duration="true">516</duration>
</phase_durations>
<!--
<phase_transition_rates units="1/min">
<rate start_index="0" end_index="1" fixed_duration="false">0.00193798</rate>
</phase_transition_rates> ok -->
<parameters>
<unlysed_fluid_change_rate units="1/min">0.05</unlysed_fluid_change_rate>
<lysed_fluid_change_rate units="1/min">0</lysed_fluid_change_rate>
<cytoplasmic_biomass_change_rate units="1/min">1.66667e-02</cytoplasmic_biomass_change_rate>
<nuclear_biomass_change_rate units="1/min">5.83333e-03</nuclear_biomass_change_rate>
<calcification_rate units="1/min">0</calcification_rate>
<relative_rupture_volume units="dimensionless">2.0</relative_rupture_volume>
</parameters>
</model>
<model code="101" name="necrosis">
<rate units="1/min">0.0</rate> <!-- Original value 0.0 -->
<phase_durations units="min">
<duration index="0" fixed_duration="true">0</duration>
<duration index="1" fixed_duration="true">86400</duration>
</phase_durations>
<!--
<transition_rates units="1/min">
<rate start_index="0" end_index="1" fixed_duration="false">9e9</rate>
<rate start_index="1" end_index="2" fixed_duration="true">1.15741e-5</rate>
</transition_rates>
-->
<parameters>
<unlysed_fluid_change_rate units="1/min">0.05</unlysed_fluid_change_rate>
<lysed_fluid_change_rate units="1/min">0</lysed_fluid_change_rate>
<cytoplasmic_biomass_change_rate units="1/min">1.66667e-02</cytoplasmic_biomass_change_rate>
<nuclear_biomass_change_rate units="1/min">5.83333e-03</nuclear_biomass_change_rate>
<calcification_rate units="1/min">0</calcification_rate>
<relative_rupture_volume units="dimensionless">2.0</relative_rupture_volume>
</parameters>
</model>
</death>
<secretion>
<substrate name="oxygen">
<secretion_rate units="1/min">0</secretion_rate>
<secretion_target units="substrate density">38</secretion_target>
<uptake_rate units="1/min">10</uptake_rate>
<net_export_rate units="total substrate/min">0</net_export_rate>
</substrate>
<substrate name="tnf">
<secretion_rate units="1/min">0</secretion_rate>
<secretion_target units="substrate density">0</secretion_target>
<uptake_rate units="1/min">0</uptake_rate>
<net_export_rate units="total substrate/min">0</net_export_rate>
</substrate>
</secretion>
<molecular />
<intracellular type="maboss">
<bnd_filename>./config/TNF_nodes.bnd</bnd_filename>
<cfg_filename>./config/TNF_conf.cfg</cfg_filename>
<time_step>10</time_step>
</intracellular>
</phenotype>
<custom_data>
<!-- Time steps for maboss update-->
<next_physiboss_run units="dimensionless">10.</next_physiboss_run>
<!-- Molecular model internal variables-->
<TNFR_binding_rate type="double" units="1/min" description="TNF receptor binding rate">0.243</TNFR_binding_rate> <!-- 0.243 -->
<TNFR_endocytosis_rate type="double" units="1/min" description="TNF receptor-TNF endocytosis rate">0.128</TNFR_endocytosis_rate>
<TNFR_recycling_rate type="double" units="1/min" description="TNF receptor recycling">0.293</TNFR_recycling_rate>
<TNFR_activation_threshold type="double" units="" description="TNFR threshold to update booleano model input">0.5</TNFR_activation_threshold>
<TNFR_receptors_per_cell type="double" units="dimensionless" description="number of TNFR receptors per cell">1.0</TNFR_receptors_per_cell>
<TNF_net_production_rate type="double" units="TNF/cell/min" description="The total TNF produced by the cell when NFkB is active">0</TNF_net_production_rate> <!-- 0.5 ng/mL -->
<!-- Auxiliary variables used to monitorize simulation-->
<tnf_node units="dimensionless">0</tnf_node>
<fadd_node units="dimensionless">0</fadd_node>
<nfkb_node units="dimensionless">0</nfkb_node>
<external_tnf units="TNF/um^3">0</external_tnf>
</custom_data>
</cell_definition>
</cell_definitions>
<user_parameters>
<random_seed type="int" units="dimensionless">0</random_seed>
<!-- example parameters from the template -->
<!-- init file -->
<init_cells_filename type="string" units="">./config/init_1k.txt</init_cells_filename>
<!-- <bnd_file type="string" units="">./config/boolean_network/TNF_nodes.bnd</bnd_file>
<cfg_file type="string" units="">./config/boolean_network/TNF_conf.cfg</cfg_file>
<maboss_time_step type="double" units="dimensionless">10.</maboss_time_step> -->
<time_add_tnf type="int" units="min">50</time_add_tnf> <!-- 150 -->
<duration_add_tnf type="int" units="min">10</duration_add_tnf> <!-- 10 -->
<concentration_tnf type="double" units="TNF/um^3"> 1.0 </concentration_tnf> <!-- 0.5 ng/mL -->
<time_remove_tnf type="int" units="min">100000</time_remove_tnf> <!-- 8000 -->
<membrane_length type="int" units=""> 250 </membrane_length>
<update_pc_parameters_O2_based type="bool" units="">true</update_pc_parameters_O2_based>
</user_parameters>
</PhysiCell_settings>
\ No newline at end of file
This diff is collapsed.
......@@ -6830,7 +6830,7 @@ void initialize_cell_definitions_from_pugixml( pugi::xml_node root )
while( node )
{
std::cout << "Processing " << node.attribute( "name" ).value() << " ... " << std::endl;
//std::cout << "Processing " << node.attribute( "name" ).value() << " ... " << std::endl;
initialize_cell_definition_from_pugixml( node );
build_cell_definitions_maps();
......
This diff is collapsed.
......@@ -131,6 +131,14 @@ class PhysiCell_Settings
PhysiCell_Settings();
void read_from_pugixml( void );
/*=========================================*/
/* Parallel prototype of the function above*/
/*=========================================*/
void read_from_pugixml( mpi_Environment &world );
};
class PhysiCell_Globals
......@@ -213,6 +221,12 @@ class User_Parameters
Parameters<std::string> strings;
void read_from_pugixml( pugi::xml_node parent_node );
/*=========================================*/
/* Parallel prototype of the function above*/
/*=========================================*/
void read_from_pugixml( pugi::xml_node parent_node, mpi_Environment &world );
};
extern PhysiCell_Globals PhysiCell_globals;
......@@ -222,6 +236,13 @@ extern PhysiCell_Settings PhysiCell_settings;
extern User_Parameters parameters;
bool setup_microenvironment_from_XML( pugi::xml_node root_node );
/*=========================================*/
/* Parallel prototype of the function above*/
/*=========================================*/
bool setup_microenvironment_from_XML( pugi::xml_node root_node, mpi_Environment &world );
bool setup_microenvironment_from_XML( void );
}
......
......@@ -169,6 +169,43 @@ void display_simulation_status( std::ostream& os )
return;
}
/*----------------------------------------*/
/* Parallel version of the function above */
/*----------------------------------------*/
void display_simulation_status( std::ostream& os, mpi_Environment &world, mpi_Cartesian &cart_topo )
{
if(IOProcessor(world))
{
os << "current simulated time: " << PhysiCell_globals.current_time << " " <<
PhysiCell_settings.time_units << " (max: " <<
PhysiCell_settings.max_time << " " <<
PhysiCell_settings.time_units << ")" << std::endl;
}
int local_cells = all_cells->size();
int global_cells;
MPI_Reduce(&local_cells, &global_cells, 1, MPI_INT, MPI_SUM, 0, cart_topo.mpi_cart_comm);
if(IOProcessor(world))
{
os << "total agents: " << global_cells << std::endl;
os << "interval wall time: ";
BioFVM::TOC();
BioFVM::display_stopwatch_value( os , BioFVM::stopwatch_value() );
os << std::endl;
BioFVM::TIC();
os << "total wall time: ";
BioFVM::RUNTIME_TOC();
BioFVM::display_stopwatch_value( os , BioFVM::runtime_stopwatch_value() );
os << std::endl << std::endl;
}
return;
}
void log_output(double t, int output_index, Microenvironment microenvironment, std::ofstream& report_file)
{
double scale=1000;
......
......@@ -78,6 +78,7 @@
#include "../core/PhysiCell.h"
#include "../BioFVM/BioFVM_MultiCellDS.h"
#include "../DistPhy/DistPhy.h"
namespace PhysiCell{
......@@ -85,6 +86,13 @@ int writePov(std::vector<Cell*> all_cells, double timepoint, double scale);
int writeCellReport(std::vector<Cell*> all_cells, double timepoint);
void display_simulation_status( std::ostream& os );
/*========================================*/
/* Parallel version of the function above */
/*========================================*/
void display_simulation_status( std::ostream& os, mpi_Environment &world, mpi_Cartesian &cart_topo );
void log_output(double t, int output_index, Microenvironment microenvironment, std::ofstream& report_file);
};
......
......@@ -241,7 +241,8 @@ int main( int argc, char* argv[] )
if(IOProcessor(world))
std::cout << "Time to save" << std::endl;
display_simulation_status( std::cout );
//Use the parallel version of the function
display_simulation_status( std::cout, world, cart_topo );
if( PhysiCell_settings.enable_legacy_saves == true )
{
......
......@@ -3,7 +3,7 @@
#SBATCH --ntasks-per-node=2
#SBATCH --cpus-per-task=24
##SBATCH --constraint=highmem
#SBATCH -t 48:00:00
#SBATCH -t 02:00:00
#SBATCH -o output-%j
#SBATCH -e error-%j
#SBATCH --exclusive
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment