Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into add_kT_to_validation
  • Loading branch information
surajkannur committed Nov 8, 2024
2 parents 8bb0126 + 8c7250c commit fbb57e2
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ on:

jobs:
stale:
uses: glotzerlab/workflows/.github/workflows/stale.yaml@ae7e7c6931098a313ef8069ef04b88a55c3a40f6 # 0.3.0
uses: glotzerlab/workflows/.github/workflows/stale.yaml@1747bc5c994ec280440dd051f2928791407692c8 # 0.5.1
8 changes: 4 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.12"
- name: Set up Python environment
uses: glotzerlab/workflows/setup-uv@ae7e7c6931098a313ef8069ef04b88a55c3a40f6 # 0.3.0
uses: glotzerlab/workflows/setup-uv@1747bc5c994ec280440dd051f2928791407692c8 # 0.5.1
with:
lockfile: ".github/workflows/requirements-test.txt"
- name: Initialize workspace
run: python3 hoomd_validation/project.py init
- name: Show workflow
run: cat --number workflow.toml
- name: Set up row
uses: glotzerlab/workflows/setup-row@ae7e7c6931098a313ef8069ef04b88a55c3a40f6 # 0.3.0
uses: glotzerlab/workflows/setup-row@1747bc5c994ec280440dd051f2928791407692c8 # 0.5.1
- name: Show project status
run: row show status
4 changes: 2 additions & 2 deletions documentation/delta.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```
max_cores_sim = 64
max_cores_submission = 512
max_gpus_submission = 8
max_cores_submission = 128
max_gpus_submission = 1
max_walltime = "2 days, 00:00:00"
```
6 changes: 6 additions & 0 deletions hoomd_validation/alj_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import itertools
import math
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -450,13 +451,18 @@ def plot(*, ax, data, quantity_name, legend=False):

fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the job complete
for job in jobs:
Path(job.fn('conservation_analyze_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.conservation_analyze',
Action(
method=conservation_analyze,
configuration={
'previous_actions': nve_md_sampling_jobs,
'products': ['conservation_analyze_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down
6 changes: 6 additions & 0 deletions hoomd_validation/hard_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import itertools
import json
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -795,13 +796,18 @@ def compare_modes(*jobs):
filename = f'hard_disk_compare_density{round(set_density, 2)}.svg'
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down
6 changes: 6 additions & 0 deletions hoomd_validation/hard_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import itertools
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -651,13 +652,18 @@ def compare_modes(*jobs):
filename = f'hard_sphere_compare_density{round(set_density, 2)}.svg'
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down
16 changes: 16 additions & 0 deletions hoomd_validation/lj_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json
import math
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -1075,13 +1076,18 @@ def compare_modes(*jobs):

fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down Expand Up @@ -1239,13 +1245,18 @@ def distribution_analyze(*jobs):
)
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('distribution_analyze_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.distribution_analyze',
Action(
method=distribution_analyze,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['distribution_analyze_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down Expand Up @@ -1470,13 +1481,18 @@ def plot(*, ax, data, quantity_name, legend=False):

fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('conservation_analyze_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.conservation_analyze',
Action(
method=conservation_analyze,
configuration={
'previous_actions': nve_md_sampling_jobs,
'products': ['conservation_analyze_complete'],
'group': _group_compare | _include_nve,
'resources': {
'processes': {'per_submission': 1},
Expand Down
16 changes: 16 additions & 0 deletions hoomd_validation/lj_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json
import math
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -1094,13 +1095,18 @@ def compare_modes(*jobs):
filename = f'lj_union_compare_kT{kT}_density{round(set_density, 2)}.svg'
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down Expand Up @@ -1299,13 +1305,18 @@ def distribution_analyze(*jobs):
)
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('distribution_analyze_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.distribution_analyze',
Action(
method=distribution_analyze,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['distribution_analyze_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down Expand Up @@ -1526,13 +1537,18 @@ def plot(*, ax, data, quantity_name, legend=False):

fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('conservation_analyze_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.conservation_analyze',
Action(
method=conservation_analyze,
configuration={
'previous_actions': nve_md_sampling_jobs,
'products': ['conservation_analyze_complete'],
'group': _group_compare | _include_nve,
'resources': {
'processes': {'per_submission': 1},
Expand Down
6 changes: 6 additions & 0 deletions hoomd_validation/patchy_particle_pressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import itertools
import json
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -805,13 +806,18 @@ def compare_modes(*jobs):
transparent=False,
)

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down
6 changes: 6 additions & 0 deletions hoomd_validation/simple_polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import itertools
import json
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -659,13 +660,18 @@ def compare_modes(*jobs):
filename = f'simple_polygon_compare_density{round(set_density, 2)}.svg'
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete')).touch()


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down
8 changes: 6 additions & 2 deletions hoomd_validation/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import argparse
import subprocess
import warnings
from pathlib import Path

import rtoml
Expand Down Expand Up @@ -77,6 +78,9 @@ def add_action(cls, name, action):
message = f'Action {name} cannot be added twice.'
raise ValueError(message)

if 'products' not in action._configuration:
warnings.warn(f'Action {name} is missing products.', stacklevel=2)

cls._actions[name] = action

@classmethod
Expand Down Expand Up @@ -138,10 +142,10 @@ def main(cls, init=None, init_args=None, **kwargs):
as options to the ``init`` subparser with ``add_argument``.
Args:
init(callable): User-provided initializaiton routine. Must take one
init(callable): User-provided initialization routine. Must take one
argument: ``args`` - the ``argparse`` parsed arguments.
init_args(list[str]): List of args to add to the ``init`` subparser.
**kwargs: Fowarded to `make_workflow`.
**kwargs: Forwarded to `make_workflow`.
"""
parser = argparse.ArgumentParser()
command = parser.add_subparsers(dest='command', required=True)
Expand Down

0 comments on commit fbb57e2

Please sign in to comment.