Skip to content

Commit c794a8f

Browse files
committed
Revised according to the comment
1 parent 769add1 commit c794a8f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

core/runtime/runtime.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace core {
1616
namespace runtime {
1717

1818
using EngineID = int64_t;
19-
const std::string ABI_VERSION = "7";
19+
const std::string ABI_VERSION = "8";
2020
extern bool MULTI_DEVICE_SAFE_MODE;
2121

2222
typedef enum {
@@ -46,9 +46,6 @@ std::string base64_encode(const std::string& in);
4646
std::string base64_decode(const std::string& in);
4747
std::string serialize_bindings(const std::vector<std::string>& bindings);
4848

49-
std::string resource_allocation_strategy_to_string(TRTEngine::ResourceAllocationStrategy strategy);
50-
TRTEngine::ResourceAllocationStrategy resource_allocation_strategy_from_string(const std::string& str);
51-
5249
c10::optional<RTDevice> get_most_compatible_device(
5350
const RTDevice& target_device,
5451
const RTDevice& curr_device = RTDevice(),

examples/dynamo/dynamic_memory_allocation.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# %%
2+
import gc
3+
import time
4+
25
import numpy as np
36
import torch
47
import torch_tensorrt as torch_trt
58
import torchvision.models as models
6-
import time
7-
import gc
89

910
np.random.seed(5)
1011
torch.manual_seed(5)
@@ -16,17 +17,19 @@
1617
"enabled_precisions": {torch.float32},
1718
"immutable_weights": False,
1819
"lazy_engine_init": True,
19-
"dynamically_allocate_resources": True
20-
20+
"dynamically_allocate_resources": True,
2121
}
2222

2323
model = models.resnet152(pretrained=True).eval().to("cuda")
2424
compiled_module = torch_trt.compile(model, inputs=inputs, **settings)
2525
print((torch.cuda.mem_get_info()[1] - torch.cuda.mem_get_info()[0]) / 1024**3)
2626
compiled_module(*inputs)
2727

28+
2829
time.sleep(30)
29-
with torch_trt.dynamo.runtime.ResourceAllocationStrategy(compiled_module, dynamically_allocate_resources=False):
30+
with torch_trt.dynamo.runtime.ResourceAllocationStrategy(
31+
compiled_module, dynamically_allocate_resources=False
32+
):
3033
print(
3134
"Memory used (GB):",
3235
(torch.cuda.mem_get_info()[1] - torch.cuda.mem_get_info()[0]) / 1024**3,

0 commit comments

Comments
 (0)