umask 077 module load verdi/Y-2026.03-SP1-1 if ($status != 0) then echo "ERROR: module load failed" exit 2 endif if ($?VERDI_MODEL_CONFIG == 0) then echo "ERROR: VERDI_MODEL_CONFIG is not set" exit 3 endif if (! -f "$VERDI_MODEL_CONFIG") then echo "ERROR: model config does not exist" exit 4 endif set run_dir = "/eda/synopsys/verdi/runtime/$USER" mkdir -p "$run_dir" chmod 700 "$run_dir" @ candidate = 30000 + ( $SLURM_JOB_ID % 10001 ) @ attempt = 0 while ($attempt < 200) set port_in_use = `ss -ltnH "sport = :$candidate" | wc -l` if ($port_in_use == 0) then setenv MCP_PORT "$candidate" break endif @ candidate = 30000 + ( ( $candidate - 29999 ) % 10001 ) @ attempt++ end if ($attempt == 200) then echo "ERROR: no free MCP port" exit 5 endif set MCP_NODE = `hostname -f` setenv MCP_URL "http://$MCP_NODE:$MCP_PORT/sse" set info_file = "$run_dir/verdi-mcp-$SLURM_JOB_ID.csh" echo "setenv MCP_JOB_ID $SLURM_JOB_ID" >! "$info_file" echo "setenv MCP_NODE $MCP_NODE" >> "$info_file" echo "setenv MCP_PORT $MCP_PORT" >> "$info_file" echo "setenv MCP_URL $MCP_URL" >> "$info_file" chmod 600 "$info_file" cd /eda/synopsys/verdi/projects/demo exec /eda/synopsys/verdi/bin/agentic mcp_verdi_assistant_agent \ --stateful-mode \ --mcp-mode sse \ --mcp-server-port "$MCP_PORT"