Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix ci failure #186

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions python/test/mscclpp_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def finalize_mpi():
MPI.Finalize()


def abort_mpi():
if MPI.Is_initialized():
MPI.COMM_WORLD.Abort()


# Register the function to be called on exit
atexit.register(finalize_mpi)

Expand Down
94 changes: 49 additions & 45 deletions python/test/test_mscclpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)
from ._cpp import _ext
from .mscclpp_group import MscclppGroup
from .mscclpp_mpi import MpiGroup, parametrize_mpi_groups, mpi_group
from .mscclpp_mpi import MpiGroup, parametrize_mpi_groups, mpi_group, abort_mpi
from .utils import KernelBuilder, pack

ethernet_interface_name = "eth0"
Expand Down Expand Up @@ -205,50 +205,54 @@ def __init__(
scratch=None,
fifo=None,
):
if test_name == "h2d_semaphore":
self._kernel = KernelBuilder(
file="h2d_semaphore_test.cu",
kernel_name="h2d_semaphore",
).get_compiled_kernel()
self.nblocks = 1
self.nthreads = nranks
elif test_name == "d2d_semaphore":
self._kernel = KernelBuilder(
file="d2d_semaphore_test.cu",
kernel_name="d2d_semaphore",
).get_compiled_kernel()
self.nblocks = 1
self.nthreads = nranks
elif test_name == "sm_channel":
self._kernel = KernelBuilder(
file="sm_channel_test.cu",
kernel_name="sm_channel",
).get_compiled_kernel()
self.nblocks = nranks
self.nthreads = 1024
elif test_name == "fifo":
self._kernel = KernelBuilder(
file="fifo_test.cu",
kernel_name="fifo",
).get_compiled_kernel()
self.nblocks = 1
self.nthreads = 1
elif test_name == "proxy":
self._kernel = KernelBuilder(
file="proxy_test.cu",
kernel_name="proxy",
).get_compiled_kernel()
self.nblocks = 1
self.nthreads = nranks
elif test_name == "simple_proxy_channel":
self._kernel = KernelBuilder(
file="simple_proxy_channel_test.cu",
kernel_name="simple_proxy_channel",
).get_compiled_kernel()
self.nblocks = 1
self.nthreads = 1024
else:
assert False
try:
if test_name == "h2d_semaphore":
self._kernel = KernelBuilder(
file="h2d_semaphore_test.cu",
kernel_name="h2d_semaphore",
).get_compiled_kernel()
self.nblocks = 1
self.nthreads = nranks
elif test_name == "d2d_semaphore":
self._kernel = KernelBuilder(
file="d2d_semaphore_test.cu",
kernel_name="d2d_semaphore",
).get_compiled_kernel()
self.nblocks = 1
self.nthreads = nranks
elif test_name == "sm_channel":
self._kernel = KernelBuilder(
file="sm_channel_test.cu",
kernel_name="sm_channel",
).get_compiled_kernel()
self.nblocks = nranks
self.nthreads = 1024
elif test_name == "fifo":
self._kernel = KernelBuilder(
file="fifo_test.cu",
kernel_name="fifo",
).get_compiled_kernel()
self.nblocks = 1
self.nthreads = 1
elif test_name == "proxy":
self._kernel = KernelBuilder(
file="proxy_test.cu",
kernel_name="proxy",
).get_compiled_kernel()
self.nblocks = 1
self.nthreads = nranks
elif test_name == "simple_proxy_channel":
self._kernel = KernelBuilder(
file="simple_proxy_channel_test.cu",
kernel_name="simple_proxy_channel",
).get_compiled_kernel()
self.nblocks = 1
self.nthreads = 1024
else:
assert False
except Exception:
abort_mpi()
raise

self.params = b""
if test_name in ["h2d_semaphore", "d2d_semaphore", "sm_channel", "simple_proxy_channel"]:
Expand Down
2 changes: 1 addition & 1 deletion python/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def _compile_cuda(self, source_file, output_file, device_id, std_version="c++17"
]
try:
subprocess.run(command, capture_output=True, text=True, check=True, bufsize=1)
with open(f"{self._tempdir.name}/{output_file}", "rb") as f:
with open(os.path.join(self._tempdir.name, output_file), "rb") as f:
return f.read()
except subprocess.CalledProcessError as e:
raise RuntimeError("Compilation failed:", e.stderr, " ".join(command))
Expand Down
2 changes: 1 addition & 1 deletion test/deploy/pytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ if [[ $OMPI_COMM_WORLD_RANK == 0 ]]
then
pytest /root/mscclpp/python/test/test_mscclpp.py -x -v
else
pytest /root/mscclpp/python/test/test_mscclpp.py -x 2>&1 >/dev/null
pytest /root/mscclpp/python/test/test_mscclpp.py -x >/dev/null
fi