You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地通过apt安装Slurm后无法找到sbatch.c文件的技术问询

解决Slurm安装后找不到sbatch.c文件的问题

Hey there! Let's break down why you can't locate the sbatch.c file after installing Slurm via sudo apt-get install -y slurm-wlm slurm-wlm-doc, and how to fix it:

为什么找不到sbatch.c?

The slurm-wlm and slurm-wlm-doc packages you installed are precompiled binary packages—they only include ready-to-run executables (like the sbatch command), configuration files, and documentation. Source code files like sbatch.c aren't included in these packages by default.

获取sbatch.c的两种方法

方法1:通过APT获取对应版本的源码包

APT has a built-in way to download the source code for packages you've installed. Here's how:

  • First, install tools needed to handle source packages:
    sudo apt-get install -y dpkg-dev
    
  • Next, ensure your system can access source repositories. Open /etc/apt/sources.list with a text editor (like nano) and check for lines starting with deb-src (matching your Ubuntu version's main repository). If missing, add a line like this (replace jammy with your Ubuntu codename, e.g., focal for 20.04):
    deb-src http://archive.ubuntu.com/ubuntu/ jammy main universe
    
  • Update your package lists:
    sudo apt update
    
  • Download the Slurm source code:
    apt source slurm-wlm
    
    This will create a directory in your current folder with the Slurm source code. You'll find sbatch.c inside slurm-<version>/src/sbatch/.

方法2:从Slurm的Git仓库克隆源码

If you want the latest (or a specific) version of the source code, clone the official repository:

  • Clone the repo:
    git clone https://github.com/SchedMD/slurm.git
    
  • Switch to the branch/tag matching your installed Slurm version (check with sbatch --version):
    cd slurm
    git checkout <version-tag>  # e.g., git checkout slurm-23.02.6
    
  • Navigate to the sbatch source directory:
    cd src/sbatch/
    
    You'll find sbatch.c here.

额外提示:如果只是测试sbatch命令

If you don't actually need the source code and just want to test using the sbatch command, you don't need sbatch.c at all. Create a simple test script (e.g., test_job.sh):

#!/bin/bash
#SBATCH --job-name=test_job
#SBATCH --output=test_output.txt

echo "Hello from Slurm!"
date

Then submit it with:

sbatch test_job.sh

You'll get a job ID, and the output will be in test_output.txt once the job runs.

内容的提问来源于stack exchange,提问作者addrienne lagua

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 10:28:48