Revert "Loads .pyd instead of .so in MemPool test for windows (#132749)"

This reverts commit 37ab0f33854fafdf9bf4f575260329ffcd960d13.

Reverted https://github.com/pytorch/pytorch/pull/132749 on behalf of https://github.com/syed-ahmed due to Seems like periodic is still failing: 7c79e89bc5 ([comment](https://github.com/pytorch/pytorch/pull/132749#issuecomment-2274041302))
This commit is contained in:
PyTorch MergeBot
2024-08-07 18:08:44 +00:00
parent a62710c820
commit 123d9ec5bf
2 changed files with 4 additions and 6 deletions

View File

@ -4984,6 +4984,7 @@ class TestMemPool(TestCase):
# increments the id
self.assertTrue(abs(pool2[1] - pool1[1]) > 0)
@unittest.skipIf(IS_WINDOWS, "fails in periodic")
def test_mempool_with_allocator(self):
pool = torch.cuda.MemPool()
@ -4993,11 +4994,9 @@ class TestMemPool(TestCase):
from torch.utils.cpp_extension import load_inline
dummy_allocator_source = """
#include <torch/extension.h>
extern "C" {
// Note that windows needs __declspec(dllexport): https://stackoverflow.com/a/24575865
C10_EXPORT void* dummy_alloc(size_t size, int device, void* stream) { return nullptr; }
C10_EXPORT void dummy_free(void* ptr) { }
void* dummy_alloc(size_t size, int device, void* stream) { return nullptr; }
void dummy_free(void* ptr) { }
}
"""
dummy_allocator_libname = "dummy_allocator"
@ -5009,7 +5008,7 @@ class TestMemPool(TestCase):
build_directory=tempdir,
)
allocator = torch.cuda.memory.CUDAPluggableAllocator(
dummy_allocator,
os.path.join(tempdir, f"{dummy_allocator_libname}.so"),
"dummy_alloc",
"dummy_free",
)

View File

@ -2143,7 +2143,6 @@ def _import_module_from_library(module_name, path, is_python_module):
return module
else:
torch.ops.load_library(filepath)
return filepath
def _write_ninja_file_to_build_library(path,