Skip to content

Commit

Permalink
Merge pull request #92 from rootfs/kernel_modules
Browse files Browse the repository at this point in the history
Kernel modules support
  • Loading branch information
rootfs authored Dec 14, 2023
2 parents 64bc8e2 + ab5712e commit 3634de6
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
# test action works running from the graph
test_local_cluster:
runs-on: ubuntu-latest
env:
KERNEL_MODULE_NAMES: "rapl,intel_rapl_common,intel_rapl_msr"
strategy:
matrix:
cluster_provider: [kind, microshift]
Expand Down Expand Up @@ -78,3 +80,14 @@ jobs:
run: |
./verify.sh cluster
# test if kernel module can be loaded, this is very os and instance specific, ignore if it fails
test_kernel_module:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
kernel_module_names: ${{ env.KERNEL_MODULE_NAMES }}}
- name: verify
run: |
./verify.sh modprobe ${{ env.KERNEL_MODULE_NAMES }}
34 changes: 33 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

34 changes: 33 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,28 @@ function installLinuxHeaders() {
executeCommand("sudo apt-get install -y linux-headers-`uname -r`", "fail to install linux headers");
}

function installLinuxModules() {
core.info(`Linux modules`);
executeCommand("sudo apt-get install -y linux-modules-`uname -r`", "fail to install linux modules");
}

function installLinuxExtraModules() {
core.info(`Linux extra modules`);
executeCommand("sudo apt-get install -y linux-modules-extra-`uname -r`", "fail to install linux extra modules");
}

function modprobe(moduleName) {
core.info(`modprobe`);
if (moduleName == "") {
core.info(`module name is empty, skip modprobe`);
return;
}
core.info(`modprobe `+moduleName);
// ignore error, since this is a very os and kernel version specific command
executeCommand("sudo modprobe "+moduleName + " || true", "fail to modprobe");
}


function installBcc(bcc_version) {
core.info(`Get BCC with version:` + bcc_version);
executeCommand("wget https://github.com/sustainable-computing-io/kepler-ci-artifacts/releases/download/v"+bcc_version+"/bcc_v"+bcc_version+".tar.gz", "fail to get BCC deb");
Expand Down Expand Up @@ -89,7 +111,17 @@ async function run() {
try {
const artifacts_version = getInputOrDefault('artifacts_version', '0.26.0');
const xgboost_version = getInputOrDefault('xgboost_version', '');
const libbpf_version = getInputOrDefault('libbpf_version', 'v1.2.0');
const libbpf_version = getInputOrDefault('libbpf_version', 'v1.2.0');
const kernel_module_names = getInputOrDefault('kernel_module_names', ''); // comma delimited names, for example: rapl,intel_rapl_common

if (kernel_module_names.length > 0) {
core.info(`kernel_module_names are `+ kernel_module_names);
installLinuxModules();
installLinuxExtraModules();
// loop through all kernel module names
kernel_module_names.split(',').forEach(modprobe);
}

// if xgboost_version is empty, skip xgboost installation
if (xgboost_version.length === 0) {
core.info(`xgboost_version is empty, skip xgboost installation`);
Expand Down
18 changes: 17 additions & 1 deletion verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ function verify_cluster() {
done
}

function verify_modprobe() {
modules=$1
# modules are separated by comma, loop to check each module
for module in $(echo $modules | tr "," "\n"); do
if [ $(lsmod | grep $module | wc -l) == 0 ]; then
echo "no $module module found"
# ignore the error for now, since this is very os and kernel version specific
exit 0
fi
done
}

function main() {
# verify the deployment of cluster
case $1 in
Expand All @@ -94,10 +106,14 @@ function main() {
cluster)
verify_cluster
;;
modprobe)
module=$2
verify_modprobe $module
;;
*)
#verify_bcc
verify_cluster
;;
esac
}
main $1
main $1 $2

0 comments on commit 3634de6

Please sign in to comment.