Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 9 additions & 2 deletions cuequivariance_jax/examples/mace_linen.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,19 @@ def inference(w, batch_dict):
)

try:
import nvtx

cuda = ctypes.CDLL("libcudart.so")
cuda.cudaProfilerStart()

if mode in ["train", "both"]:
jax.block_until_ready(step(w, opt_state, batch_dict, target_E, target_F))
with nvtx.annotate("Train", color="green"):
jax.block_until_ready(
step(w, opt_state, batch_dict, target_E, target_F)
)
if mode in ["inference", "both"]:
jax.block_until_ready(inference(w, batch_dict))
with nvtx.annotate("Inference", color="blue"):
jax.block_until_ready(inference(w, batch_dict))
cuda.cudaProfilerStop()
except Exception:
pass
Expand Down
16 changes: 11 additions & 5 deletions cuequivariance_jax/examples/mace_nnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,15 +644,21 @@ def inference(graphdef, state, batch_dict):
)

try:
import nvtx

cuda = ctypes.CDLL("libcudart.so")
cuda.cudaProfilerStart()
if mode in ["train", "both"]:
train_state = step(
train_graphdef, train_state, batch_dict, target_E, target_F
)
jax.block_until_ready(train_state)
with nvtx.annotate("Train", color="green"):
train_state = step(
train_graphdef, train_state, batch_dict, target_E, target_F
)
jax.block_until_ready(train_state)
if mode in ["inference", "both"]:
jax.block_until_ready(inference(model_graphdef, model_state, batch_dict))
with nvtx.annotate("Inference", color="blue"):
jax.block_until_ready(
inference(model_graphdef, model_state, batch_dict)
)
cuda.cudaProfilerStop()
except Exception:
pass
Expand Down
Loading