Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated scripts to build, run, test all sample projects #247

Merged
merged 8 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions beta/test_build_all.sh

This file was deleted.

106 changes: 106 additions & 0 deletions beta/test_build_samples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Copy this file to the root dir and run it from a Unix bash shell: sh test_build_samples.sh
#
# WARNING: this is primarily intended to be used by core developers when testing a new release.
# It will create new directories in /user_projects
#
# Based on the following:
#
# $ make list-projects
# Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample
# celltypes3-sample heterogeneity-sample pred-prey-farmer virus-macrophage-sample
# worm-sample interaction-sample mechano-sample rules-sample physimess-sample
#
# Note that it does not currently test building the intracellular projects:
# Sample intracellular projects: template_BM ode-energy-sample physiboss-cell-lines-sample
# cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion
#
#
# After running the script, you can :
# 1) confirm all executables were created
# $ ls -l template_sample biorobots cancer_biorobots cancer_immune_3D celltypes3 heterogeneity pred_prey virus_sample worm interaction_demo mechano_sample rules_sample physimess_sample
# and then:
# 2) confirm the user_projects were created; delete them
# $ cd user_projects
# $ ls
# $ rm -rf template biorobots cancer_biorobots cancer_immune celltypes3 hetero pred_prey virus_mac worm interaction mechano rules physimess

make reset
make template
make
mv project template_sample
make save PROJ=template
#
echo "\n-----------------------------------------"
make reset
make biorobots-sample
make
make save PROJ=biorobots
#
echo "\n-----------------------------------------"
make reset
make cancer-biorobots-sample
make
make save PROJ=cancer_biorobots
#
echo "\n-----------------------------------------"
make reset
make cancer-immune-sample
make
make save PROJ=cancer_immune
#
echo "\n-----------------------------------------"
make reset
make celltypes3-sample
make
make save PROJ=celltypes3
#
echo "\n-----------------------------------------"
make reset
make heterogeneity-sample
make
make save PROJ=hetero
#
echo "\n-----------------------------------------"
make reset
make pred-prey-farmer
make
make save PROJ=pred_prey
#
echo "\n-----------------------------------------"
make reset
make virus-macrophage-sample
make
make save PROJ=virus_mac
#
echo "\n-----------------------------------------"
make reset
make worm-sample
make
make save PROJ=worm
#
echo "\n-----------------------------------------"
make reset
make interaction-sample
make
make save PROJ=interaction
#
echo "\n-----------------------------------------"
make reset
make mechano-sample
make
mv project mechano_sample
make save PROJ=mechano
#
echo "\n-----------------------------------------"
make reset
make rules-sample
make
mv project rules_sample
make save PROJ=rules
#
echo "\n-----------------------------------------"
make reset
make physimess-sample
make
mv project physimess_sample
make save PROJ=physimess
64 changes: 64 additions & 0 deletions beta/test_run_samples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copy this Python script to the root dir and run it to:
# - load each sample project (from user_projects)
# - compile it
# - modify each project's .xml: max_time, # threads, output folder
# - run it
#
# WARNING: this is primarily intended to be used by core developers when testing a new release.
# It will create new output directories ("output_<proj>")
#
# Reminder:
# $ ls user_projects/
# biorobots/ hetero/ pred_prey/ worm/
# cancer_biorobots/ interaction/ rules/
# cancer_immune/ mechano/ template/
# celltypes3/ physimess/ virus_mac/

# Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample
# celltypes3-sample heterogeneity-sample pred-prey-farmer virus-macrophage-sample
# worm-sample interaction-sample mechano-sample rules-sample physimess-sample
#
# It does not currently test running the intracellular projects:
# Sample intracellular projects: template_BM ode-energy-sample physiboss-cell-lines-sample
# cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion
#
#
# If you want to cleanup the created execs:
# $ rm -rf template biorobots cancer_biorobots cancer_immune celltypes3 hetero pred_prey virus_mac worm interaction mechano rules physimess

import subprocess
import xml.etree.ElementTree as ET
import os
import time

# skip over the 3D cancer_immune_sample for now
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add context so we know when to include that project in testing?

Copy link
Collaborator

@drbergman drbergman Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you said you should add comments to it, I would also appreciate clarity on this one :)

Copy link
Collaborator Author

@rheiland rheiland Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed edits which includes running that 3D cancer_immune project now. Also note that the physimess project will have an error due to not having a cp -r in the make load ... (only until 1.14.0 is released, hopefully), thereby preventing it from compiling and running.

user_proj = ["template", "biorobots", "cancer_biorobots", "celltypes3", "hetero", "pred_prey", "virus_mac", "worm", "interaction", "mechano", "rules", "physimess"] #
model_execs = ["project", "biorobots", "cancer_biorobots", "celltypes3", "heterogeneity", "pred_prey", "virus-sample", "worm", "interaction_demo", "project", "project", "project"]

# using dummy values of 99; users can change
max_times = [120, 10, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99]

for (uproj, myexec, max_time) in zip(user_proj, model_execs, max_times):
print("\n\n------------ ",uproj,myexec, " ----------------------------------")
subprocess.run(["make","reset"])
# make load PROJ=template
s= "PROJ=" + uproj
print("\n ---- doing: make load ",s)
subprocess.run(["make","load",s])
subprocess.run(["make"])

# update max_time and omp_num_threads (=1)
tree = ET.parse('config/PhysiCell_settings.xml')
root = tree.getroot()
root.find(".//max_time").text = str(max_time)
root.find(".//omp_num_threads").text = "1"
new_output_dir = "output_" + uproj
root.find(".//save//folder").text = new_output_dir
tree.write('config/PhysiCell_settings.xml')
try:
os.makedirs(new_output_dir)
except:
pass
time.sleep(1)

subprocess.run([myexec])
Loading