Skip to content

Commit

Permalink
#422: try putting vttv import in a try/except block for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed May 16, 2024
1 parent d40c0f1 commit fe2ed30
Showing 1 changed file with 33 additions and 28 deletions.
61 changes: 33 additions & 28 deletions src/lbaf/Applications/LBAF_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import importlib
import yaml

import vttv
try:
import vttv
using_vttv = True
except ModuleNotFoundError:
using_vttv = False

# pylint:disable=C0413:wrong-import-position
# Use lbaf module from source if lbaf package is not installed
Expand Down Expand Up @@ -572,33 +576,34 @@ def run(self):
]

# Call vttv visualization
self.__logger.info("Calling vt-tv")

# Serialize data to JSON-formatted string
self.__rank_phases = {}
for p in phases.values():
for r in p.get_ranks():
self.__rank_phases.setdefault(r.get_id(), {})
self.__rank_phases[r.get_id()][p.get_id()] = r

ranks_json_str = []
for i in range(len(self.__rank_phases.items())):
ranks_json_str.append(self.__json_writer._json_serializer((i, self.__rank_phases[i])))

vttv_params = {
"x_ranks": self.__parameters.grid_size[0],
"y_ranks": self.__parameters.grid_size[1],
"z_ranks": self.__parameters.grid_size[2],
"object_jitter": self.__parameters.object_jitter,
"rank_qoi": self.__parameters.rank_qoi,
"object_qoi": self.__parameters.object_qoi,
"save_meshes": self.__parameters.save_meshes,
"force_continuous_object_qoi": self.__parameters.continuous_object_qoi,
"output_visualization_dir": self.__parameters.output_dir,
"output_visualization_file_stem": self.__parameters.output_file_stem
}
num_ranks = self.__parameters.grid_size[0] * self.__parameters.grid_size[1] * self.__parameters.grid_size[2]
vttv.tv_from_json(ranks_json_str, str(vttv_params), num_ranks)
if using_vttv:
self.__logger.info("Calling vt-tv")

# Serialize data to JSON-formatted string
self.__rank_phases = {}
for p in phases.values():
for r in p.get_ranks():
self.__rank_phases.setdefault(r.get_id(), {})
self.__rank_phases[r.get_id()][p.get_id()] = r

ranks_json_str = []
for i in range(len(self.__rank_phases.items())):
ranks_json_str.append(self.__json_writer._json_serializer((i, self.__rank_phases[i])))

vttv_params = {
"x_ranks": self.__parameters.grid_size[0],
"y_ranks": self.__parameters.grid_size[1],
"z_ranks": self.__parameters.grid_size[2],
"object_jitter": self.__parameters.object_jitter,
"rank_qoi": self.__parameters.rank_qoi,
"object_qoi": self.__parameters.object_qoi,
"save_meshes": self.__parameters.save_meshes,
"force_continuous_object_qoi": self.__parameters.continuous_object_qoi,
"output_visualization_dir": self.__parameters.output_dir,
"output_visualization_file_stem": self.__parameters.output_file_stem
}
num_ranks = self.__parameters.grid_size[0] * self.__parameters.grid_size[1] * self.__parameters.grid_size[2]
vttv.tvFromJson(ranks_json_str, str(vttv_params), num_ranks)

# Report on rebalanced phase when available
if rebalanced_phase:
Expand Down

0 comments on commit fe2ed30

Please sign in to comment.