Skip to content

Commit

Permalink
#507: Deprecate LBAF-Viz and replace with calls to vt-tv (#508)
Browse files Browse the repository at this point in the history
* #507: add deprecate error to lbsVisualizer

* #507: add test for deprecation warning

* #507: remove all references to visualization in unit test config files

* #507: add newline

* #507: remove viz params from all config files

* #507: add config file test for lbaf viz deprecation

* #507: remove config file test; clean up viz deprecation

* #507: restore config test for viz deprecation
  • Loading branch information
cwschilly authored May 22, 2024
1 parent f88d2de commit ed0db06
Show file tree
Hide file tree
Showing 47 changed files with 87 additions and 386 deletions.
11 changes: 0 additions & 11 deletions config/challenging-toy-fewer-tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,3 @@ algorithm:
# Specify output
output_dir: ../output
output_file_stem: output_file
visualization:
x_ranks: 4
y_ranks: 4
z_ranks: 1
object_jitter: 0.5
#rank_qoi: homed_blocks_ratio
rank_qoi: max_memory_usage
object_qoi: shared_block_id
save_meshes: false
output_visualization_dir: ../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions config/challenging-toy-hundreds-tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,3 @@ algorithm:
# Specify output
output_dir: ../output
output_file_stem: output_file
visualization:
x_ranks: 8
y_ranks: 8
z_ranks: 1
object_jitter: 0.5
rank_qoi: load
save_meshes: false
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
22 changes: 11 additions & 11 deletions config/conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ write_JSON:
suffix: json
communications: true
offline_LB_compatible: false
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: work
object_qoi: load
save_meshes: true
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
# visualization:
# x_ranks: 2
# y_ranks: 2
# z_ranks: 1
# object_jitter: 0.5
# rank_qoi: work
# object_qoi: load
# save_meshes: true
# force_continuous_object_qoi: true
# output_visualization_dir: ../output
# output_visualization_file_stem: output_file
9 changes: 0 additions & 9 deletions config/every20phases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,3 @@ algorithm:
# Specify output
output_dir: ../output
output_file_stem: output_file
visualization:
x_ranks: 8
y_ranks: 4
z_ranks: 1
object_jitter: 0.5
rank_qoi: work
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
11 changes: 0 additions & 11 deletions config/step.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,3 @@ algorithm:
# Specify output
output_dir: ../output
output_file_stem: output_file
visualization:
x_ranks: 8
y_ranks: 4
z_ranks: 1
object_jitter: 0.5
rank_qoi: work
object_qoi: load
save_meshes: true
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
11 changes: 0 additions & 11 deletions config/user-defined-memory-toy-problem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,3 @@ write_JSON:
suffix: json
communications: true
offline_LB_compatible: true
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: load
object_qoi: load
save_meshes: true
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
7 changes: 0 additions & 7 deletions src/lbaf/Applications/LBAF_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,6 @@ def run(self):
"Grid size: {self.__parameters.grid_size} < {n_ranks}")
raise SystemExit(1)

# Look for prescribed QOI bounds
qoi_request = [
self.__parameters.rank_qoi,
self.__parameters.work_model.get("parameters", {}).get("upper_bounds", {}).get(self.__parameters.rank_qoi),
self.__parameters.object_qoi
]

# Call vttv visualization
if using_vttv:
self.__logger.info("Calling vt-tv")
Expand Down
8 changes: 7 additions & 1 deletion src/lbaf/IO/lbsVisualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@


class Visualizer:
"""A class to visualize LBAF results via mesh files and VTK views."""
"""A class to visualize LBAF results via mesh files and VTK views.
lbsVisualizer has been deprecated in favor of vt-tv. This module will be removed
in a future release."""

def __init__(
self,
Expand All @@ -40,6 +43,9 @@ def __init__(
statistics: a dictionary of per-phase global statistics
resolution: grid_resolution value."""

# Throw deprecation error immediately
raise DeprecationWarning("LBAF's Visualizer has been deprecated and will be removed in a future release. Visualizations should be generated with DARMA/vt-tv.")

# Assign logger to instance variable
self.__logger = logger

Expand Down
28 changes: 28 additions & 0 deletions tests/unit/IO/test_lbs_visualizer_deprecation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os
import logging
import unittest
import subprocess
from src.lbaf.IO.lbsVisualizer import Visualizer

class TestVizDeprecation(unittest.TestCase):
"""Test for lbsVisualizer's deprecation."""

def test_lbs_visualizer_deprecation(self):
try:
visualizer = Visualizer(
logger=logging.getLogger(),
qoi_request=["this", "that", "the other thing"],
continuous_object_qoi=False,
phases=["phase 1", "phase 2"],
grid_size=[0,0,1,1])
except DeprecationWarning as e:
assert str(e) == "LBAF's Visualizer has been deprecated and will be removed in a future release. Visualizations should be generated with DARMA/vt-tv."

def test_lbs_visualizer_config(self):
config_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), "config", "conf_wrong_visualization.yml")
pipes = subprocess.Popen(["python", "src/lbaf", "-c", config_file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
std_err = pipes.communicate()[1].decode("utf-8")
assert "Visualization enabled but vttv not found. No visualization will be generated." in std_err

if __name__ == "__main__":
unittest.main()
4 changes: 0 additions & 4 deletions tests/unit/IO/test_vt_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ def test_vt_writer_required_fields_output(self):
output_file_name = f"{output_file_prefix}.{i}.json"
output_file = os.path.join(output_dir, output_file_name)

print(f"[{__loader__.name}] Compare input file ({input_file_name}) and output file ({output_file_name})...")

# validate that output file exists at rank i
self.assertTrue(
os.path.isfile(output_file),
Expand Down Expand Up @@ -218,8 +216,6 @@ def test_vt_writer_communications_output(self):
output_file_name = f"{output_file_prefix}.{r_id}.json"
output_file = os.path.join(output_dir, output_file_name)

# print(f"[{__loader__.name}] Compare input file ({input_file_name}) and output file ({output_file_name})...")

# validate that output file exists at rank i
self.assertTrue(
os.path.isfile(output_file),
Expand Down
10 changes: 0 additions & 10 deletions tests/unit/config/conf_correct_001.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,3 @@ algorithm:
# Specify output
output_dir: ../../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: None
object_qoi: None
force_continuous_object_qoi: true
output_visualization_dir: ../../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_correct_002.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,3 @@ algorithm:
# Specify output
output_dir: ../../../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: None
object_qoi: None
force_continuous_object_qoi: true
output_visualization_dir: ../../../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_correct_003.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,3 @@ algorithm:
logging_level: debug
output_dir: ../../../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: None
object_qoi: None
force_continuous_object_qoi: true
output_visualization_dir: ../../../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_correct_brute_force.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,3 @@ algorithm:
logging_level: debug
output_dir: ../../../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: work
object_qoi: load
force_continuous_object_qoi: true
output_visualization_dir: ../../../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_correct_clustering.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,3 @@ algorithm:
# Specify output
output_dir: ../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: load
object_qoi: load
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_correct_clustering_set_tol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,3 @@ algorithm:
# Specify output
output_dir: ../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: load
object_qoi: load
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_correct_clustering_target_imb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,3 @@ algorithm:
# Specify output
output_dir: ../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: load
object_qoi: load
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_correct_from_data_min_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,3 @@ algorithm:

# Specify output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: work
object_qoi: work
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_correct_from_samplers_no_ll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,3 @@ algorithm:
# Specify output
output_dir: ../../../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: None
object_qoi: None
force_continuous_object_qoi: true
output_visualization_dir: ../../../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_correct_phase_ids_str_001.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,3 @@ algorithm:
# Specify output
output_dir: ../../../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: None
object_qoi: None
force_continuous_object_qoi: true
output_visualization_dir: ../../../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_wrong_algorithm_invalid_001.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,3 @@ algorithm:

# Specify output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: work
object_qoi: work
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_wrong_algorithm_invalid_002.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,3 @@ algorithm:
# Specify output
output_dir: ../../../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: None
object_qoi: None
force_continuous_object_qoi: true
output_visualization_dir: ../../../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_wrong_clustering_set_tol_mag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,3 @@ algorithm:
# Specify output
output_dir: ../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: load
object_qoi: load
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_wrong_clustering_set_tol_type.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,3 @@ algorithm:
# Specify output
output_dir: ../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: load
object_qoi: load
force_continuous_object_qoi: true
output_visualization_dir: ../output
output_visualization_file_stem: output_file
10 changes: 0 additions & 10 deletions tests/unit/config/conf_wrong_data_and_sampling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,3 @@ algorithm:
# Specify output
output_dir: ../../../output
output_file_stem: output_file
visualization:
x_ranks: 2
y_ranks: 2
z_ranks: 1
object_jitter: 0.5
rank_qoi: None
object_qoi: None
force_continuous_object_qoi: true
output_visualization_dir: ../../../output
output_visualization_file_stem: output_file
Loading

0 comments on commit ed0db06

Please sign in to comment.