Skip to content

Commit d839c35

Browse files
author
root
committed
include vllm_mlu specific changes
1 parent 4f5dfa7 commit d839c35

3 files changed

Lines changed: 40 additions & 28 deletions

File tree

python/ray/_private/node.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,10 +815,29 @@ def get_log_file_names(
815815
log_stdout = None
816816
log_stderr = None
817817

818-
if create_out:
818+
'''
819+
=============================
820+
Modify by vllm_mlu
821+
=============================
822+
@brief: disable ray dump log to prevent log files from continuously growing
823+
'''
824+
DEVNULL_PATH = '/dev/null' if sys.platform != 'win32' else 'NUL'
825+
if (
826+
name in ["gcs_server", "raylet"] \
827+
and ("VLLM_DUMP_RAY_LOG_EN" not in os.environ or \
828+
os.environ["VLLM_DUMP_RAY_LOG_EN"].lower() not in ["true", "1"])
829+
):
830+
log_stdout = DEVNULL_PATH
831+
elif create_out:
819832
log_stdout = self._get_log_file_name(name, "out", unique=unique)
833+
'''
834+
==================
835+
End of MLU Hijack
836+
==================
837+
'''
820838
if create_err:
821839
log_stderr = self._get_log_file_name(name, "err", unique=unique)
840+
822841
return log_stdout, log_stderr
823842

824843
def get_log_file_handles(

python/ray/_private/runtime_env/nsight.py

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@
1717
default_logger = logging.getLogger(__name__)
1818

1919
# Nsight options used when runtime_env={"_nsight": "default"}
20-
NSIGHT_DEFAULT_CONFIG = {
21-
"t": "cuda,cudnn,cublas,nvtx",
22-
"o": "'worker_process_%p'",
23-
"stop-on-exit": "true",
24-
}
25-
20+
# use default cnperf config, no need to specify any options
21+
NSIGHT_DEFAULT_CONFIG = {}
2622

2723
def parse_nsight_config(nsight_config: Dict[str, str]) -> List[str]:
2824
"""
@@ -32,7 +28,7 @@ def parse_nsight_config(nsight_config: Dict[str, str]) -> List[str]:
3228
The function returns:
3329
- List[str]: nsys profile cmd line split into list of str
3430
"""
35-
nsight_cmd = ["nsys", "profile"]
31+
nsight_cmd = ["cnperf-cli", "record"]
3632
for option, option_val in nsight_config.items():
3733
# option standard based on
3834
# https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
@@ -68,10 +64,11 @@ async def _check_nsight_script(
6864

6965
# use empty as nsight report test filename
7066
nsight_config_copy = copy.deepcopy(nsight_config)
71-
nsight_config_copy["o"] = str(Path(self._nsight_dir) / "empty")
67+
try_to_create_directory(Path(self._nsight_dir) / "empty")
68+
nsight_config_copy["o"] = str(Path(self._nsight_dir) / "empty/test")
7269
nsight_cmd = parse_nsight_config(nsight_config_copy)
7370
try:
74-
nsight_cmd = nsight_cmd + [sys.executable, "-c", '""']
71+
nsight_cmd = nsight_cmd + ["python", "-c", '""']
7572
process = await asyncio.create_subprocess_exec(
7673
*nsight_cmd,
7774
stdout=subprocess.PIPE,
@@ -80,8 +77,8 @@ async def _check_nsight_script(
8077
stdout, stderr = await process.communicate()
8178
error_msg = stderr.strip() if stderr.strip() != "" else stdout.strip()
8279

83-
# cleanup test.nsys-rep file
84-
clean_up_cmd = ["rm", f"{nsight_config_copy['o']}.nsys-rep"]
80+
# cleanup test.cnperf-rep file
81+
clean_up_cmd = ["rm", f"{nsight_config_copy['o']}.cnperf-rep"]
8582
cleanup_process = await asyncio.create_subprocess_exec(
8683
*clean_up_cmd,
8784
stdout=subprocess.PIPE,
@@ -93,7 +90,7 @@ async def _check_nsight_script(
9390
else:
9491
return False, error_msg
9592
except FileNotFoundError:
96-
return False, ("nsight is not installed")
93+
return False, ("cnperf-cli is not installed")
9794

9895
async def create(
9996
self,
@@ -108,7 +105,7 @@ async def create(
108105

109106
if nsight_config and sys.platform != "linux":
110107
raise RuntimeEnvSetupError(
111-
"Nsight CLI is only available in Linux.\n"
108+
"CNPerf CLI is only available in Linux.\n"
112109
"More information can be found in "
113110
"https://docs.nvidia.com/nsight-compute/NsightComputeCli/index.html"
114111
)
@@ -120,21 +117,16 @@ async def create(
120117
raise RuntimeEnvSetupError(
121118
f"Unsupported nsight config: {nsight_config}. "
122119
"The supported config is 'default' or "
123-
"Dictionary of nsight options"
120+
"Dictionary of cnperf options"
124121
)
125122

126123
is_valid_nsight_cmd, error_msg = await self._check_nsight_script(nsight_config)
127124
if not is_valid_nsight_cmd:
128125
logger.warning(error_msg)
129126
raise RuntimeEnvSetupError(
130-
"nsight profile failed to run with the following "
127+
"cnperf-cli failed to run with the following "
131128
f"error message:\n {error_msg}"
132129
)
133-
# add set output path to logs dir
134-
nsight_config["o"] = str(
135-
Path(self._nsight_dir) / nsight_config.get("o", NSIGHT_DEFAULT_CONFIG["o"])
136-
)
137-
138130
self.nsight_cmd = parse_nsight_config(nsight_config)
139131
return 0
140132

@@ -145,5 +137,5 @@ def modify_context(
145137
context: RuntimeEnvContext,
146138
logger: Optional[logging.Logger] = default_logger,
147139
):
148-
logger.info("Running nsight profiler")
149140
context.py_executable = " ".join(self.nsight_cmd) + " python"
141+
logger.info("Running CNPerf cmd: %s", context.py_executable)

python/ray/_private/worker.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,12 +2496,13 @@ def connect(
24962496
error_message = "Perhaps you called ray.init twice by accident?"
24972497
assert not worker.connected, error_message
24982498

2499-
# Enable nice stack traces on SIGSEGV etc.
2500-
try:
2501-
if not faulthandler.is_enabled():
2502-
faulthandler.enable(all_threads=False)
2503-
except io.UnsupportedOperation:
2504-
pass # ignore
2499+
# FIXME: tmp disable faulthandler
2500+
# # Enable nice stack traces on SIGSEGV etc.
2501+
# try:
2502+
# if not faulthandler.is_enabled():
2503+
# faulthandler.enable(all_threads=False)
2504+
# except io.UnsupportedOperation:
2505+
# pass # ignore
25052506

25062507
worker.gcs_client = node.get_gcs_client()
25072508
assert worker.gcs_client is not None

0 commit comments

Comments
 (0)