Skip to content
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

freecad stable #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions bc_vt_freecad/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 1.0.0 - 2021-07-02
### Added
- Initial release!

61 changes: 61 additions & 0 deletions bc_vt_freecad/DevGuide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

# Batch Connect - Matlab app

An example Batch Connect app that launches a Matlab application within a
batch job.

## Prerequisites

This Batch Connect app requires the following software be installed on the
**compute nodes** that the batch job is intended to run on (**NOT** the
OnDemand node):

- [OpenSSL](https://www.openssl.org/) 1.0.1+ (used to hash the Jupyter Notebook
server password)
- [Lmod](https://www.tacc.utexas.edu/research-development/tacc-projects/lmod)
6.0.1+ or any other `module purge` and `module load <modules>` based CLI
used to load appropriate environments within the batch job before launching
the Jupyter Notebook server.
- [Singularity](https://sylabs.io/guides/3.0/user-guide/installation.html) Singularity is a container platform. It allows you to create and run containers that package up pieces of software in a way that is portable and reproducible. ... Your container is a single file, and you don't have to worry about how to install all the software you need on each different operating system and system.

## Downloading and building docker image
``` sh
singularity pull freecad.sif docker://vtarc/bc_vt_freecad:latest
```

- Change the Sif file locations in [script.sh.erb](./template/script.sh.erb#L27)


### Development Installation

```bash
cd /home/<user>/ondemand/dev
git clone [email protected]:AdvancedResearchComputing/OnDemandApps.git
```

### System Installation
```bash
cd /var/www/ood/apps/sys
git clone [email protected]:AdvancedResearchComputing/OnDemandApps.git
```

> Make sure to give executable permissions for *image file*


- Make necessary description changes to **[manifest.yml](./manifest.yml)**

### Packages made available under this [DockerImage](https://hub.docker.com/repository/docker/vtarc/bc_vt_freecad) or [Dockerfile](./Dockerfiles/Dockerfile):

``` sh
freecad
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

---
9 changes: 9 additions & 0 deletions bc_vt_freecad/Dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM accetto/ubuntu-vnc-xfce-firefox-g3:latest


RUN echo -e "headless\n" | sudo -S apt-get update \
&& echo -e "headless\n" | sudo -S apt install -y build-essential libpci-dev libwebkit2gtk-4.0-dev apt-utils freecad\
&& echo -e "headless\n" | sudo -S apt clean

# RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN echo -e "headless\n" | sudo -S DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends nvidia-nsight
24 changes: 24 additions & 0 deletions bc_vt_freecad/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2021 Virginia Tech

Copyright (c) 2016-2018 Ohio Supercomputer Center

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 changes: 12 additions & 0 deletions bc_vt_freecad/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# OnDemand FreeCad

[FreeCad ]: https://developer.nvidia.com/nsight-eclipse-edition

A noVNC based [FreeCad] app for ondemand

- FreeCad
- Loads Cuda toolkit latest 11.4

## Setup
- Dockerfile uses Accetto base image
- Pre loads cuda toolkit 10.1 on host node
6 changes: 6 additions & 0 deletions bc_vt_freecad/form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict'

$(document).ready(function() {
// Set the max value to be what was set in the last session

});
73 changes: 73 additions & 0 deletions bc_vt_freecad/form.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Batch Connect app configuration file
#
---
cluster:
- 'tinkercliffs'
- 'infer'

# Define attribute values that aren't meant to be modified by the user within
# the Dashboard form
attributes:

# specify widgets for user modifiable job settings
bc_queue:
help: |
- To request a GPU enabled queue, preface it with v100_. Example: v100_normal_q, t4_normal_q

bc_num_hours:
label: Number of hours (min-1, max-48)
required: true
value: 1
min: 1
max: 72
step: 1

bc_num_slots:
label: Number of nodes (currently confined to 1)
required: true
value: 1
min: 1
max: 1
step: 1

bc_account:
widget: text_field
label: Account
value: ""
help: |
- The allocation you would like to use for SLURM.

num_cores:
widget: number_field
label: Number of cores per node (min-1, max-32)
value: 1
min: 1
max: 32
step: 1

gpu_per_node:
widget: number_field
label: Number of GPUs per node (min-0, max-2)
value: 0
min: 0
max: 1
step: 1
help: |
- If requesting GPU nodes, you must enter a GPU-enabled Partition above or the job will fail.

bc_vnc_resolution:
required: true

form:
- cluster
- ide_version
- bc_account
- reservation
- bc_queue
- bc_num_hours
- bc_num_slots
- num_cores
- gpu_per_node
- bc_vnc_resolution
- bc_email_on_started

Binary file added bc_vt_freecad/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions bc_vt_freecad/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: FreeCAD Stable
category: Interactive Apps
role: batch_connect
description: |
This app will launch [FreeCAD Stable] on [TinkerCliffs] and [Infer].
[TinkerCliffs]: https://www.arc.vt.edu/TinkerCliffs
[Infer]: https://www.arc.vt.edu/infer
26 changes: 26 additions & 0 deletions bc_vt_freecad/submit.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Job submission configuration file
#
---

#
# Configure the content of the job script for the batch job here
# @see http://www.rubydoc.info/gems/ood_core/OodCore/BatchConnect/Template
#
batch_connect:
template: "basic"
set_host: "host=$(hostname -s)"
#
# Configure the job script submission parameters for the batch job here
# @see http://www.rubydoc.info/gems/ood_core/OodCore/Job/Script
#
script:
copy_environment: true
native:
- "--nodes=<%= bc_num_slots.blank? ? "1" : bc_num_slots.to_i %>"
- "--cpus-per-task=<%= num_cores.blank? ? "1" : num_cores %>"
- "--time=<%= bc_num_hours + ":0:0" %>"
- "--reservation=<%= reservation %>"
- "--account=<%= bc_account %>"
<%- if gpu_per_node.to_i > 0 -%>
- "--gres=gpu:<%= gpu_per_node.to_i %>"
<%- end -%>
13 changes: 13 additions & 0 deletions bc_vt_freecad/template/after.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Wait for the X server to start

while [ ! -f ./connection.rc ]; do sleep 1; done
source connection.rc

echo "Waiting for VNC Server to open port ${host}:${port}..."
if wait_until_port_used "${host}:${port}" 2400; then
echo "Discovered VNC Server listening on port ${port}!"
else
echo "Timed out waiting for VNC Server to open port ${port}!"
clean_up 1
fi
sleep 2
27 changes: 27 additions & 0 deletions bc_vt_freecad/template/before.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Export the module function if it exists
[[ $(type -t module) == "function" ]] && export -f module
hostname
pwd
moduel reset
module load cuda-latest/toolkit
module load containers/singularity
#echo loaded cuda toolkit
module list
SINGULARITYENV_PATH=$PATH
SINGULARITYENV_CUDA_PATH=$CUDA_PATH
SINGULARITYENV_CUDA_ROOT=$CUDA_ROOT
SINGULARITYENV_CUDA_CMLOCAL_ROOT=$CUDA_CMLOCAL_ROOT
SINGULARITYENV_CUDA_INSTALL_PATH=$CUDA_INSTALL_PATH
SINGULARITYENV_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
SINGULARITYENV_CUDA_HOME=$CUDA_HOME
SINGULARITYENV_CUDA_INC_PATH=$CUDA_INC_PATH
SINGULARITYENV_CUDA_SDK=$CUDA_SDK
SINGULARITYENV_LIBRARY_PATH=$LIBRARY_PATH
SINGULARITYENV_PATH=$PATH

singularity run --nv --cleanenv --env PYTHONPATH=/usr/local/lib/python3.8/dist-packages/websockify-0.9.0-py3.8.egg --env PATH=$PATH \
--env PYTHONPATH=/usr/local/lib/python3.8/dist-packages/websockify-0.9.0-py3.8.egg --bind `pwd`:/cwd,/projects,/cm/shared \
/projects/arcsingularity/ubuntu-xfce-v0.0.1.sif &
#while [ ! -f ./connection.rc ]; do sleep 1; done
#source connection.rc

45 changes: 45 additions & 0 deletions bc_vt_freecad/template/script.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
while [ ! -f ./connection.rc ]; do sleep 1; done
source ./connection.rc

unset XDG_RUNTIME_DIR

module list

echo running on `hostname`
echo starting singularity
module load containers/singularity

echo loading cuda toolkit version <%= context.ide_version%>
module load cuda-latest/toolkit
echo loaded cuda toolkit

sleep 2
ls /tmp/.X11-unix
echo starting Nsight Eclipse container

echo DISPLAY:$DISPLAY
echo USER:$USER


# Path to Eclipse TC Image
freecad_image='/projects/arcsingularity/freecad_stable_0.16.sif'
echo eclipseImagePath:$freecad_image

module list
env
echo cuda path: $CUDA_PATH
SINGULARITYENV_CUDA_PATH=$CUDA_PATH
SINGULARITYENV_CUDA_ROOT=$CUDA_ROOT
SINGULARITYENV_CUDA_CMLOCAL_ROOT=$CUDA_CMLOCAL_ROOT
SINGULARITYENV_CUDA_INSTALL_PATH=$CUDA_INSTALL_PATH
SINGULARITYENV_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
SINGULARITYENV_CUDA_HOME=$CUDA_HOME
SINGULARITYENV_CUDA_INC_PATH=$CUDA_INC_PATH
SINGULARITYENV_CUDA_SDK=$CUDA_SDK
SINGULARITYENV_LIBRARY_PATH=$LIBRARY_PATH
SINGULARITYENV_PATH=$PATH
echo "singularity exec --env DISPLAY=$DISPLAY --env CUDA_PATH=$CUDA_PATH --env CUDA_CMLOCAL_ROOT=$CUDA_CMLOCAL_ROOT--writable-tmpfs --bind=/cm/shared:/cm/shared,/tmp:/tmp,/tmp/.X11-unix:/tmp/.X11-unix,/projects:/projects,/work:/work $freecad_image /usr/bin/freecad"

singularity exec --nv --env DISPLAY=$DISPLAY --env CUDA_PATH=$CUDA_PATH --env CUDA_CMLOCAL_ROOT=$CUDA_CMLOCAL_ROOT --writable-tmpfs --bind=/cm/shared:/cm/shared,/tmp:/tmp,/tmp/.X11-unix:/tmp/.X11-unix,/projects:/projects,/work:/work $freecad_image /usr/bin/freecad
wait $!
9 changes: 9 additions & 0 deletions bc_vt_freecad/view.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<form action="/rnode/<%= host %>/<%= port %>/vnc.html">
<input type="hidden" name="autoconnect" value="true">
<input type="hidden" name="password" value="<%= password %>">
<input type="hidden" name="port" value="<%= port %>">
<input type="hidden" name="host" value="ood.arc.vt.edu/rnode/<%= host %>/<%= port %> ">
<button class="btn btn-primary" type="submit">
<i class="fa faeye"></i> "Connect to FreeCad - /home"
</button>
</form>