mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: torch_ucc uses `deleteKey`, and trying to run PyTorch tests with torch_ucc leads to failure about `deleteKey not implemented for FileStore`. cc pietern mrshenli pritamdamania87 zhaojuanmao satgera rohan-varma gqchen aazzolini osalpekar jiayisuse SciPioneer H-Huang Pull Request resolved: https://github.com/pytorch/pytorch/pull/69953 Reviewed By: ngimel Differential Revision: D33458457 Pulled By: H-Huang fbshipit-source-id: f46afd59f950722ae594d9aafb8843f14019e930
46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <c10d/Store.hpp>
|
|
#include "TestUtils.hpp"
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
namespace c10d {
|
|
namespace test {
|
|
|
|
inline void set(
|
|
Store& store,
|
|
const std::string& key,
|
|
const std::string& value) {
|
|
std::vector<uint8_t> data(value.begin(), value.end());
|
|
store.set(key, data);
|
|
}
|
|
|
|
inline std::vector<uint8_t> compareSet(
|
|
Store& store,
|
|
const std::string& key,
|
|
const std::string& expectedValue,
|
|
const std::string& desiredValue) {
|
|
std::vector<uint8_t> expectedData(expectedValue.begin(), expectedValue.end());
|
|
std::vector<uint8_t> desiredData(desiredValue.begin(), desiredValue.end());
|
|
return store.compareSet(key, expectedData, desiredData);
|
|
}
|
|
|
|
inline void check(
|
|
Store& store,
|
|
const std::string& key,
|
|
const std::string& expected) {
|
|
auto tmp = store.get(key);
|
|
auto actual = std::string((const char*)tmp.data(), tmp.size());
|
|
EXPECT_EQ(actual, expected);
|
|
}
|
|
|
|
inline void deleteKey(
|
|
Store& store,
|
|
const std::string& key) {
|
|
store.deleteKey(key);
|
|
}
|
|
|
|
} // namespace test
|
|
} // namespace c10d
|