Skip to content

Build hpcugent 20.11 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pyslurm/*.pxi~
pyslurm/*.pxd~
pyslurm/*.so
pyslurm/*.c
pyslurm/*.pxd

# Ignore vim swap files
*.swp
Expand Down
92 changes: 92 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Build PySlurm (20.11.2)

## Prepare Slurm container (optional)

```bash
git clone https://github.com/bikerdanny/docker-centos-slurm
cd docker-centos-slurm
pip3 install j2cli
j2 Dockerfile.j2 config.ini > Dockerfile
docker build -t bikerdanny/slurm:20.02.5 .
sed -i "s/controller1/c10/g" config.ini
sed -i "s/compute1/c10/g" config.ini
j2 aio.docker-compose.yml.j2 config.ini > docker-compose.yml
mkdir var_lib_mysql
mkdir etc_munge
mkdir etc_slurm
mkdir shared
docker-compose up -d
docker-compose exec c10 bash
supervisorctl stop slurmctld
echo "SwitchName=s2 Nodes=c10" > /etc/slurm/topology.conf
echo "#
# TOPOLOGY
TopologyPlugin=topology/tree
#
# PlugStackConfig
PlugStackConfig=/etc/slurm/plugstack.conf" >> /etc/slurm/slurm.conf
sacctmgr show cluster # if the command returns successfully, you can start slurmctld again
supervisorctl start slurmctld
sinfo
```
The following steps you could do inside the container.

## Checkout PySlurm

```bash
cd /root
git clone https://github.com/bikerdanny/pyslurm.git
cd pyslurm
git checkout 20.02.5
```

## Build pxd files for slurm.h slurmdb.h and slurm_errno.h

```bash
pip3 install autopxd2
cd /usr/include
autopxd --include-dir /usr/include slurm/slurm.h /root/pyslurm/pyslurm/slurm.h.pxd
autopxd --include-dir /usr/include slurm/slurmdb.h /root/pyslurm/pyslurm/slurmdb.h.pxd
autopxd --include-dir /usr/include slurm/slurm_errno.h /root/pyslurm/pyslurm/slurm_errno.h.pxd
```

## Patch and modify pxd files

```bash
cd /root/pyslurm/pyslurm
patch -p0 < slurm.h.pxd.patch
patch -p0 < slurmdb.h.pxd.patch
sed -i "s/slurm_addr_t control_addr/#slurm_addr_t control_addr/g" slurmdb.h.pxd
sed -i "s/pthread_mutex_t lock/#pthread_mutex_t lock/g" slurmdb.h.pxd
patch -p0 < slurm_errno.h.pxd.patch
```

## Create slurm.pxd from template slurm.j2

```bash
cd /root/pyslurm/pyslurm
pip3 install j2cli
j2 slurm.j2 > slurm.pxd
```

## Build and install PySlurm

If you do not want to do all the above steps and just try the generated `slurm.pxd`from
the above procedure. You can copy for example:
* cp generated/20.11/slurm.pxd pyslurm
* then build it with the below procedure

```bash
pip3 install Cython
cd /root/pyslurm
python3 setup.py build
python3 setup.py install
```

## Test PySlurm

```bash
pip3 install nose
cd /root
python3 $(which nosetests) -v pyslurm/tests
```
Loading