Skip to content

Commit b6cd46e

Browse files
Fix gems info file format (#220)
### PR Category Core ### PR Type User Experience ### Description When tensor-parallel-size > 1, multiple worker processes wrote to /tmp/flaggems_enable_oplist.txt simultaneously, causing file truncation and interleaved log lines. Fix: pass record=True only on rank 0; other ranks register ops normally but skip file logging.
1 parent 96b2e01 commit b6cd46e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

vllm_fl/worker/worker.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,27 +234,31 @@ def __init__(
234234
# Get whitelist and blacklist from environment variables
235235
whitelist, blacklist = get_flag_gems_whitelist_blacklist()
236236

237+
# Only rank 0 records the oplist to avoid file truncation and
238+
# interleaved writes when tensor-parallel-size > 1.
239+
should_record = (rank == 0)
240+
237241
# Use whitelist if specified (takes precedence over blacklist)
238242
if whitelist:
239243
logger.info(f"[FlagGems] Enable only the following ops: {whitelist}")
240244
flag_gems.only_enable(
241245
include=whitelist,
242-
record=True,
246+
record=should_record,
243247
once=True,
244248
path=fl_envs.FLAGGEMS_ENABLE_OPLIST_PATH,
245249
)
246250
elif blacklist:
247251
logger.info(f"[FlagGems] Disable the following ops: {blacklist}")
248252
flag_gems.enable(
249253
unused=blacklist,
250-
record=True,
254+
record=should_record,
251255
once=True,
252256
path=fl_envs.FLAGGEMS_ENABLE_OPLIST_PATH,
253257
)
254258
else:
255259
logger.info("[FlagGems] Enable all ops")
256260
flag_gems.enable(
257-
record=True, once=True, path=fl_envs.FLAGGEMS_ENABLE_OPLIST_PATH
261+
record=should_record, once=True, path=fl_envs.FLAGGEMS_ENABLE_OPLIST_PATH
258262
)
259263

260264
# def sleep(self, level: int = 1) -> None:

0 commit comments

Comments
 (0)