===== SlicerNNInteractive Server. =====
See [[https://github.com/coendevente/SlicerNNInteractive|SlicerNNInteractive]] github page for more information.
==== A Step by step guide to setup/start/stop the SlicerNNInteractive Server on the HPC/Slurm cluster. ====
This examples uses two folders
- a folder for the python virtual environment : **//SlicerNNInteractive//**
- a folder for submitting the SlicerNNInteractive Server task : **//NNInteractive//**
=== Server side installation. ===
* Prepare a python3 virtual environment.
# create python environment
python3 -m venv SlicerNNInteractive
# activate python environment
source SlicerNNInteractive/bin/activate
# install SlicerNNInteractive server
pip install nninteractive-slicer-server
# deactivate environment
deactivate
* Prepare a job directory for the NNInteractive Server.
# make a base folder for the NNInteractive Server
mkdir NNInteractive
# go into the base folder
cd NNInteractive
# copy theslurm sbatch template for starting the server
cp /software/example/run-nninteractive-slicer-server.sbatch .
# defaults are set to 1 node, 16 cpu, 32GB memory, 1 Gpu.
# modify the top of the file where needed.
=== Client side installation. ===
See further instructions here : [[https://github.com/coendevente/SlicerNNInteractive?tab=readme-ov-file#client-side-installation-in-3d-slicer|SlicerNNInteractive]]
=== Starting the SlicerNNInteractive Server ===
* Submit the job by running the following command :
# go to the base folder where the submit script is located.
cd NNInteractive
# start the slurm job
sbatch run-nninteractive-slicer-server.sbatch
# keep track of the final job id (eg: Submitted batch job )
Once the server is started, monitor the content of the nninteractive-slicer-server-.log file.
tail nninteractive-slicer-server-.log
Wait until it contains a similar content like the following listed below :
....
INFO: Started server process [1200063]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://ctit088.ewi.utwente.nl:8882 (Press CTRL+C to quit)
The url being listed is the one you will need to use in the client that runs on your own laptop/workstation.
=== Connecting from the Client to the SlicerNNInteractive Server ===
Go to the nnInteractive module in Slicer and in the Configuration tab type in the URL listed in the nninteractive-slicer-server-.log file when starting the server.
Keep in mind that every time you start the server this URL will be different.
See further instructions here : [[https://github.com/coendevente/SlicerNNInteractive?tab=readme-ov-file#client-side-installation-in-3d-slicer|SlicerNNInteractive]]
=== Stopping the SlicerNNInteractive Server ===
The example script will terminate the SlicerNNInteractive Server after 2 hrs. You can modify this to a different time, however if you don't use it anymore you should terminate the SlicerNNInteractive Server.
Use the jobnumber to terminate the SlicerNNInteractive Server.
scancel