Commit 26f7e196 authored by Ramon Nou's avatar Ramon Nou
Browse files

added more module

parent 7980a6c4
Loading
Loading
Loading
Loading
Loading

scripts/run/fuse-0.9.6

0 → 100644
+80 −0
Original line number Diff line number Diff line
#%Module1.0
########################################################
#
# Author: Ramon Nou
#
########################################################

set PROG_NAME           GekkoFS
set PROG_VERSION        fuse-0.9.6
set BASE                /apps/GPP/GEKKOFS
set PROG_HOME           $BASE/gkfs-fuse/bin/gkfs_daemon
set PROG_PROXY          $BASE/gkfs-fuse/bin/gkfs_proxy
set PROG_FUSE           $BASE/gkfs-fuse/bin/fuse_client
set PRLD_HOME           $BASE/gkfs-fuse/lib64/libgkfs_intercept.so
set LIBC_HOME           $BASE/gkfs-fuse/lib64/libgkfs_libc_intercept.so
set LIBS                $BASE/deps-master/lib64:$BASE/deps-master/lib:$BASE/gkfs-fuse/lib64
set GKFS_RUN            $BASE/gkfs-master/bin/gkfs_run

proc ModulesHelp { } {
    puts stderr "----------------------------------------------------------------"
    puts stderr "\tGekkoFS Module fuse-0.9.6"
    puts stderr "----------------------------------------------------------------"
    puts stderr "\nDescription:"
    puts stderr "\tThis module loads the environment for GekkoFS (FUSE version)."
    puts stderr "\tIt sets up environment variables and providing helper scripts."
    puts stderr "\nDefined Environment Variables:"
    puts stderr "\tGKFS_DAEMON      : Path to the GekkoFS daemon executable"
    puts stderr "\tGKFS_PROXY       : Path to the GekkoFS proxy executable"
    puts stderr "\tGKFS_FUSE        : Path to the GekkoFS FUSE client executable"
    puts stderr "\tGKFS_INTERCEPT   : Path to the interception library"
    puts stderr "\tGKFS_LIBC        : Path to the libc interception library"
    puts stderr "\tLD_LIBRARY_PATH  : Includes GekkoFS and ADMIRE dependencies"
    puts stderr "\tGKFS_MNT         : Default mount point for GekkoFS (can be overridden)"
    puts stderr "\tGKFS_ROOT        : Default root directory for GekkoFS (can be overridden)"
    puts stderr "\nHelper Scripts:"
    puts stderr "\t\$GKFS_RUN start      : Launch GekkoFS servers (requires Slurm allocation)"
    puts stderr "\t\$GKFS_RUN start_fuse : Launch GekkoFS servers AND FUSE clients"
    puts stderr "\t\$GKFS_RUN stop       : Stop GekkoFS servers/clients and cleanup"
    puts stderr "----------------------------------------------------------------"
    puts stderr "\nExample:"
    puts stderr "\t# No LD_PRELOAD needed with FUSE"
    puts stderr "\t./your_application"
    puts stderr "----------------------------------------------------------------"
    puts stderr "\nMore information: https://storage.bsc.es/gitlab/hpc/gekkofs/"
}

module-whatis   "Loads the $PROG_NAME $PROG_VERSION Environment"

# Consistency check
conflict ${PROG_NAME}

# Load required modules
if { [ module-info mode load ] } {
    module unload impi oneapi
    module load ucx/1.16.0-gcc libfabric/1.21.0-gcc gcc/14.1.0_binutils241
}

# Set Environment Variables
setenv          GKFS_DAEMON         $PROG_HOME
setenv          GKFS_PROXY          $PROG_PROXY
setenv          GKFS_FUSE           $PROG_FUSE
setenv          GKFS_INTERCEPT      $PRLD_HOME
setenv          GKFS_LIBC           $LIBC_HOME
setenv          GKFS_LOG_LEVEL      1
setenv          GKFS_DAEMON_LOG_LEVEL 0

# Useful defaults (can be overridden by user)
setenv        GKFS_MNT            /dev/shm/gkfs_mnt
setenv        GKFS_ROOT           $env(TMPDIR)/gkfs_root
setenv        GKFS_HOSTS_FILE     $env(HOME)/gkfs_hosts.txt
setenv        LIBGKFS_HOSTS_FILE  $env(HOME)/gkfs_hosts.txt
setenv        GKFS_RUN            $GKFS_RUN

prepend-path    LD_LIBRARY_PATH     $LIBS
prepend-path    PATH                [file dirname [info script]]

if { [module-info mode] != "whatis" } {
    puts stderr "GekkoFS FUSE environment loaded."
    puts stderr "Run 'module help [module-info name]' for more information."
}
+59 −10
Original line number Diff line number Diff line
@@ -7,16 +7,18 @@ export GKFS_DAEMON_LOG_LEVEL=${GKFS_DAEMON_LOG_LEVEL:-0}

# Helper function to print usage
usage() {
    echo "Usage: $0 {start|stop|help}"
    echo "Usage: $0 {start|stop|start_fuse|stop_fuse|help}"
    echo
    echo "Commands:"
    echo "  start       Start GekkoFS daemons on allocated nodes"
    echo "  stop        Stop GekkoFS daemons and clean up"
    echo "  start_fuse  Start GekkoFS FUSE clients (requires servers running)"
    echo "  stop_fuse   Stop GekkoFS FUSE clients"
    echo "  help        Show this help message"
}

# Function to start daemons
start() {
start_servers() {
    if [ -z "$SLURM_JOB_NUM_NODES" ]; then
        echo "Error: SLURM_JOB_NUM_NODES not set. Are you in a Slurm allocation?"
        exit 1
@@ -63,13 +65,40 @@ start() {
        sleep 1
    done
    
    echo "GekkoFS is ready."
    echo "GekkoFS servers are ready."
    echo "Mount point: ${GKFS_MNT}"
    echo "Hosts file: ${GKFS_HOSTS_FILE}"
}

start_fuse() {
    # Check if servers are running (simplistic check via hosts file)
    # We allow user to run this independently, but warn if servers might not be ready
    if [ -z "$GKFS_HOSTS_FILE" ]; then
         export GKFS_HOSTS_FILE=${HOME}/gkfs_hosts.txt
    fi
    
    if [ ! -f "$GKFS_HOSTS_FILE" ]; then
        echo "Warning: Hosts file $GKFS_HOSTS_FILE not found. Are servers running?"
    fi

    echo "Starting GekkoFS FUSE Clients..."
    if [ -z "$GKFS_FUSE" ]; then
        echo "Error: GKFS_FUSE not set. Did you load the fuse module?"
        exit 1
    fi
    
    CMD2="${GKFS_FUSE} -o max_idle_threads=32 -o direct_io -f -o fifo -o auto_unmount $GKFS_MNT"
    
    srun -N ${SLURM_JOB_NUM_NODES} \
         -n ${SLURM_JOB_NUM_NODES} \
         --export="ALL" --oversubscribe --overlap \
         /bin/bash -c "${CMD2}" &
         
    echo "FUSE clients launched."
}

# Function to stop daemons
stop() {
stop_servers() {
    if [ -z "$SLURM_JOB_NUM_NODES" ]; then
        echo "Error: SLURM_JOB_NUM_NODES not set. Are you in a Slurm allocation?"
        exit 1
@@ -80,16 +109,36 @@ stop() {
         -c 1 --mem=0 --oversubscribe --export="ALL" \
         /bin/bash -c "pkill --signal SIGINT gkfs_daemon ; rm -rf ${GKFS_MNT} ${GKFS_ROOT}"
    
    echo "Cleanup complete."
    echo "Server cleanup complete."
}

stop_fuse() {
    if [ -z "$SLURM_JOB_NUM_NODES" ]; then
        echo "Error: SLURM_JOB_NUM_NODES not set. Are you in a Slurm allocation?"
        exit 1
    fi
    
    echo "Stopping GekkoFS FUSE clients..."
    srun -n ${SLURM_JOB_NUM_NODES} -N ${SLURM_JOB_NUM_NODES} \
         -c 1 --mem=0 --oversubscribe --export="ALL" \
         /bin/bash -c "pkill --signal SIGINT fuse_client"

    echo "FUSE cleanup complete."
}

# Main logic
case "$1" in
    start)
        start
        start_servers
        ;;
    stop)
        stop
        stop_servers
        ;;
    start_fuse)
        start_fuse
        ;;
    stop_fuse)
        stop_fuse
        ;;
    help)
        usage
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ proc ModulesHelp { } {
    puts stderr "\nExample:"
    puts stderr "\tLD_PRELOAD=\$GKFS_INTERCEPT ./your_application"
    puts stderr "----------------------------------------------------------------"
    puts stderr "\nMore information: https://storage.bsc.es/gitlab/hpc/gekkofs/"
}

module-whatis   "Loads the $PROG_NAME $PROG_VERSION Environment"
@@ -57,6 +58,7 @@ setenv GKFS_INTERCEPT $PRLD_HOME
setenv          GKFS_LIBC           $LIBC_HOME
setenv          GKFS_LOG_LEVEL      1
setenv          GKFS_DAEMON_LOG_LEVEL 0
setenv          GKFS_RUN            $GKFS_RUN

# Useful defaults (can be overridden by user)
setenv        GKFS_MNT            /dev/shm/gkfs_mnt