CTF Tools: Difference between revisions

From MEG Core
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
==== Using the CTF DataEditor with a Singularity Container ====
==== Using the CTF tools with a Singularity Container ====

The current version of the '''CTF DataEditor tool''' runs under CentOS (Linux) version 6.9. To support the MEG user community,
[mailto:holroydt@mail.nih.gov Tom Holroyd] has created a [https://singularity.lbl.gov/index.html Singularity] container for CentOS 6.9 and populated the container with the necessary libraries to run the DataEditor tool. This allows MEG users to run the DataEditor tool under the operating system (Windows, Mac OSX, Linux) of their choice.
The current version of the CTF tools run under CentOS (Linux) version 6.9. To support the MEG user community, we have a [https://singularity.lbl.gov/index.html Singularity] container for CentOS 6.9 containing the necessary libraries to run them. This allows MEG users to run the tools under the operating system (Windows, Mac OSX, Linux) of their choice.


Singularity is a
Singularity is a
[https://en.wikipedia.org/wiki/Operating-system-level_virtualization Operating-system-level virtualization] solution where an operating system
[https://en.wikipedia.org/wiki/Operating-system-level_virtualization Operating-system-level virtualization] solution where an operating system
can host another operating system in an isolated container. To run a Singularity container on your operating system, you need to install the Singularity software for your operating system. There are install packages for the major operating systems from the [https://www.sylabs.io/ Singularity website.]
can host another operating system in an isolated container. To run a Singularity container on your operating system, you need to install the Singularity software for your operating system. There are install packages for the major operating systems from the [https://www.sylabs.io/ Singularity website.]

----
----

; Singularity container running CentOS 6.9 with the CTF DataEditor tool
: [https://megcore.nih.gov/MEG/ctf-6.1.14-beta.img Singularity container ctf-6.1.14-beta.img download]
; Singularity container running CentOS 6.9 with the CTF tools
: [https://megcore.nih.gov/MEG/ctf-6.1-sing.tar Singularity container ctf-6.1-sing.tar download]
: {| width=70% style="border: 1px solid black;"
: {| width=70% style="border: 1px solid black;"
|<u>Usage</u>: singularity shell --bind /data:/mnt/data ctf-6.1.14-beta.img
|<u>Example usage</u>: singularity shell --bind /data:/mnt/data ctf6.1.sif
|-
|-
| where the ''/data'' file system holds your CTF data set and mounts under /mnt/data inside the container
| where the ''/data'' file system holds your CTF data set and mounts under /mnt/data inside the container
Line 16: Line 18:
| (your /home directory and the /tmp file systems are automatically visible inside the container)
| (your /home directory and the /tmp file systems are automatically visible inside the container)
|}
|}

Note that the ctf6.1.sif file is inside the .tar file.

Another way to use the Singularity container is to use a wrapper script. This allows you to run CTF commands from outside the Singularity environment.

To do this, unpack the .tar file above, and run the mkwrappers script.

mkdir tmp
cd tmp
tar -xf /path/to/ctf-6.1-sing.tar
./mkwrappers

You don't need the tmp directory after that. The wrappers are installed in /usr/local/ctf/bin, so put that in your path.

----

; biowulf.nih.gov users
: module load ctf

The ctf container is already installed on biowulf.

----
----
; felix.nih.gov users
: ssh -X login@felix.nih.gov
: Copy the ctf-6.1.14-beta.img to your /data directory.


; General use
: Either add '''module load singularity''' to your ~/.bashrc startup file or type this on the command line.
: Use the following bash script to shell into the singularity container.
For other machines, use the following bash script to shell into the singularity container.


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 28: Line 48:
# goctf.sh
# goctf.sh


singularity shell --bind /data/username:/mnt/data ctf-6.1.14-beta.img
singularity shell --bind /data/username:/mnt/data ctf6.1.sif
killall -s msgd 2>/dev/null
killall -s msgd 2>/dev/null
</syntaxhighlight>
</syntaxhighlight>


'''DataEditor''' and the other CTF tools communicate with each other using the '''msgd''' service, which will automatically be launched if it isn't already running. This service is not killed when you exit from the singularity container, so you will end up with a persistent process. To prevent this from occurring, just kill it, as above.
The DataEditor communicates with other CTF tools using the '''msgd''' service and the DataEditor will automatically
launch this service if it isn't running. The trouble on felix.nih.gov is this service is not killed when you exit from the singularity container and you will end up with a persistent process on felix. To prevent this from occurring, make sure msgd goes away.


You may want to add this stanza to your ~/.bashrc file on felix.nih.gov.
You may want to add this stanza to your ~/.bashrc file.
This sets both the command prompt and the command history format for your shell inside the container
This sets both the command prompt and the command history format for your shell inside the container


Line 49: Line 68:


----
----
; CTF tools native download
Instead of installing the Singularity container, you can also install the tools natively; you will need to install the necessary 32-bit libraries by hand.

: [https://megcore.nih.gov/MEG/ctf-6.1.14.tgz ctf-6.1.14.tgz download]

Latest revision as of 15:54, 15 September 2023

Using the CTF tools with a Singularity Container

The current version of the CTF tools run under CentOS (Linux) version 6.9. To support the MEG user community, we have a Singularity container for CentOS 6.9 containing the necessary libraries to run them. This allows MEG users to run the tools under the operating system (Windows, Mac OSX, Linux) of their choice.

Singularity is a Operating-system-level virtualization solution where an operating system can host another operating system in an isolated container. To run a Singularity container on your operating system, you need to install the Singularity software for your operating system. There are install packages for the major operating systems from the Singularity website.


Singularity container running CentOS 6.9 with the CTF tools
Singularity container ctf-6.1-sing.tar download
Example usage: singularity shell --bind /data:/mnt/data ctf6.1.sif
where the /data file system holds your CTF data set and mounts under /mnt/data inside the container
(your /home directory and the /tmp file systems are automatically visible inside the container)

Note that the ctf6.1.sif file is inside the .tar file.

Another way to use the Singularity container is to use a wrapper script. This allows you to run CTF commands from outside the Singularity environment.

To do this, unpack the .tar file above, and run the mkwrappers script.

mkdir tmp
cd tmp
tar -xf /path/to/ctf-6.1-sing.tar
./mkwrappers

You don't need the tmp directory after that. The wrappers are installed in /usr/local/ctf/bin, so put that in your path.


biowulf.nih.gov users
module load ctf

The ctf container is already installed on biowulf.


General use

For other machines, use the following bash script to shell into the singularity container.

#!/bin/bash
# goctf.sh

singularity shell --bind /data/username:/mnt/data ctf6.1.sif
killall -s msgd 2>/dev/null

DataEditor and the other CTF tools communicate with each other using the msgd service, which will automatically be launched if it isn't already running. This service is not killed when you exit from the singularity container, so you will end up with a persistent process. To prevent this from occurring, just kill it, as above.

You may want to add this stanza to your ~/.bashrc file. This sets both the command prompt and the command history format for your shell inside the container

if [ ! -z "$SINGULARITY_CONTAINER" ]; then
## PS1 is set inside the container
  HISTFILE=~/.bash_history
  HISTTIMEFORMAT='%Y%m%d/%H:%M:%S '
else
  export PS1='[\h \w]$ '
fi