Skip to content

Commit

Permalink
More for nvidia inference profiling (#412)
Browse files Browse the repository at this point in the history
* nvidia profiling for md

* 1 model

* hook functions

* Update md-benchmark-nsys-profile.py
  • Loading branch information
zasdfgbnm committed Jan 30, 2020
1 parent 0731668 commit 180633b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tools/md-benchmark-nsys-profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@

dyn.run(1000) # warm up


def time_func(key, func):

def wrapper(*args, **kwargs):
torch.cuda.nvtx.range_push(key)
ret = func(*args, **kwargs)
torch.cuda.nvtx.range_pop()
return ret

return wrapper


torchani.aev.cutoff_cosine = time_func('cutoff_cosine', torchani.aev.cutoff_cosine)
torchani.aev.radial_terms = time_func('radial_terms', torchani.aev.radial_terms)
torchani.aev.angular_terms = time_func('angular_terms', torchani.aev.angular_terms)
torchani.aev.compute_shifts = time_func('compute_shifts', torchani.aev.compute_shifts)
torchani.aev.neighbor_pairs = time_func('neighbor_pairs', torchani.aev.neighbor_pairs)
torchani.aev.triu_index = time_func('triu_index', torchani.aev.triu_index)
torchani.aev.cumsum_from_zero = time_func('cumsum_from_zero', torchani.aev.cumsum_from_zero)
torchani.aev.triple_by_molecule = time_func('triple_by_molecule', torchani.aev.triple_by_molecule)
torchani.aev.compute_aev = time_func('compute_aev', torchani.aev.compute_aev)

torch.cuda.cudart().cudaProfilerStart()
autonvtx(model)
with torch.autograd.profiler.emit_nvtx(record_shapes=True):
Expand Down

0 comments on commit 180633b

Please sign in to comment.