Skip to content

Commit 64940b9

Browse files
committed
Modify test code to analyze metadata and compressed data size
1 parent d361fed commit 64940b9

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

tests/test_caesarCD.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ int main(int argc, char** argv) {
198198
const std::string out_dir = "./output/";
199199
std::filesystem::create_directories(out_dir);
200200

201-
const int batch_size = 128;
201+
const int batch_size = 32;
202202
const int n_frame = 8;
203203
torch::Tensor raw = loadRawBinary(raw_path, shape);
204204

@@ -226,8 +226,22 @@ int main(int argc, char** argv) {
226226
to_5d_and_pad(raw, 256, 256, force_padding);
227227
}
228228

229-
torch::Device compression_device = torch::Device(torch::kCUDA);
230-
torch::Device decompression_device = torch::Device(torch::kCUDA);
229+
torch::Device compression_device = torch::Device(torch::kCUDA, 0);
230+
231+
auto device_count = torch::cuda::device_count();
232+
std::cout << "Detected CUDA/ROCm devices: " << device_count << std::endl;
233+
234+
torch::Device decompression_device = torch::Device(torch::kCPU);
235+
236+
if (torch::cuda::is_available()) {
237+
std::cout << "CUDA/ROCm Detected. Using GPU." << std::endl;
238+
239+
int decomp_gpu_index = (device_count > 1) ? 1 : 0;
240+
decompression_device = torch::Device(torch::kCUDA, decomp_gpu_index);
241+
242+
std::cout << " - Compression Device: GPU " << 0 << std::endl;
243+
std::cout << " - Decompression Device: GPU " << decomp_gpu_index << std::endl;
244+
}
231245

232246
std::cout << "\n===== COMPRESSION =====\n";
233247
Compressor compressor(compression_device);

0 commit comments

Comments
 (0)