From 71800959a529860b1b3144ffa4b3a904713da29c Mon Sep 17 00:00:00 2001
From: Gerald Byrket <93494625+gbyrketosc@users.noreply.github.com>
Date: Fri, 10 Dec 2021 13:56:44 -0600
Subject: [PATCH] Allow matlab to run on pitzer cluster (#15)

* Implemented Dynamic JS. All works well, except for Number of Cores and pitzer

* Added Matlab to Pitzer Cluster and migrated to Dynamic JS

* Update form.yml.erb

Co-authored-by: Jeff Ohrstrom <johrstrom@osc.edu>

* Update form.yml.erb

* Update form.yml.erb

* Update form.yml.erb

* Update form.yml.erb

* Added appropriate cluster filtering to the version selection

Co-authored-by: Jeff Ohrstrom <johrstrom@osc.edu>
---
 form.js      |  61 -------------------------
 form.yml.erb | 126 +++++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 102 insertions(+), 85 deletions(-)
 delete mode 100644 form.js

diff --git a/form.js b/form.js
deleted file mode 100644
index 65d8c46..0000000
--- a/form.js
+++ /dev/null
@@ -1,61 +0,0 @@
-'use strict'
-
-/**
- * Fix num cores, allowing blanks to remain
- */
-function fix_num_cores() {
-  let node_type_input = $('#batch_connect_session_context_node_type');
-  let node_type = node_type_input.val();
-  let num_cores_input = $('#num_cores');
-
-  if(num_cores_input.val() === '') {
-    return;
-  }
-
-  if(node_type === 'hugemem') {
-    set_ppn_owens_hugemem(num_cores_input);
-  } else {
-    set_ppn_owens_regular(num_cores_input);
-  }
-}
-
-/**
- * Sets the PPN limits available for Owens hugemem nodes.
- * 
- * hugemem reservations are always assigned the full node
- *
- * @param      {element}  num_cores_input  The input for num_cores
- */
-function set_ppn_owens_hugemem(num_cores_input) {
-  const NUM_CORES = 48;
-  num_cores_input.attr('max', NUM_CORES);
-  num_cores_input.attr('min', NUM_CORES);
-  num_cores_input.val(NUM_CORES);
-}
-
-/**
- * Sets the PPN limits available for non hugemem Owens nodes.
- *
- * @param      {element}  num_cores_input  The input for num_cores
- */
-function set_ppn_owens_regular(num_cores_input) {
-  const NUM_CORES = 28;
-  num_cores_input.attr('max', NUM_CORES);
-  num_cores_input.attr('min', 1);
-  num_cores_input.val(Math.min(NUM_CORES, num_cores_input.val()));
-}
-
-
-/**
- * Change the maximum number of cores selected.
- */
-function set_node_type_change_handler() {
-  let node_type_input = $('#batch_connect_session_context_node_type');
-  node_type_input.change(node_type_input, fix_num_cores);
-}
-
-$(document).ready(function() {
-  // Set the max value to be what was set in the last session
-  fix_num_cores();
-  set_node_type_change_handler();
-});
\ No newline at end of file
diff --git a/form.yml.erb b/form.yml.erb
index 6c7786e..8a49ec2 100644
--- a/form.yml.erb
+++ b/form.yml.erb
@@ -6,6 +6,7 @@
 ---
 cluster:
   - "owens"
+  - "pitzer"
 form:
   - version
   - account
@@ -24,9 +25,8 @@ attributes:
       Number of cores on node type (4 GB per core unless requesting whole
       node). Leave blank if requesting full node.
     min: 0
-    max: 48
+    max: 28
     step: 1
-    id: 'num_cores'
   bc_num_slots: "1"
   bc_vnc_resolution:
     required: true
@@ -38,30 +38,108 @@ attributes:
       - "<%= group %>"
       <%- end %>
   node_type:
-    widget: select
-    label: "Node type"
-    help: |
-      - **any** - (*1-28 cores*) Use any available Owens node. This reduces the
-        wait time as there are no node requirements.
-      - **hugemem** - (*48 cores*) Use an Owens node that has 1.5TB of
-        available RAM as well as 48 cores. There are 16 of these nodes on
-        Owens. Requesting hugemem nodes allocates entire nodes.
-      - **vis** - (*1-28 cores*) Use an Owens node that has an [NVIDIA Tesla P100
-        GPU](http://www.nvidia.com/object/tesla-p100.html) with an X server
-        running in the background. This utilizes the GPU for hardware
-        accelerated 3D visualization. There are 160 of these nodes on Owens.
-    options:
-      - "any"
-      - "hugemem"
-      - "vis"
+      widget: select
+      label: "Node type"
+      help: |
+        - **Standard Compute** <br>
+          These are standard HPC machines. Owens has 648 of these nodes with 40
+          cores and 128 GB of memory. Pitzer has 224 of these nodes with 40 cores and
+          340 of these nodes with 48 cores. All pitzer nodes have 192 GB of RAM. Chosing "any" as the node type will decrease
+          your wait time.
+        - **GPU Enabled** <br>
+          These are HPC machines with GPUs. Owens has 160 nodes with 1 [NVIDIA Tesla P100 GPU]
+          and Pitzer has 74 nodes with 2 [NVIDIA Tesla V100 GPUs]. They have the same
+          CPU and memory characteristics of standard compute. However, Pitzer's 40 core machines
+          have 2 GPUs with 16 GB of RAM; and Pitzer's 48 core machines have 2 GPUs with 32 GB of RAM.
+          Dense GPU types have 4 GPUs with 16 GB of RAM.
+        - **Large Memory** <br>
+          These are HPC machines with very large amounts of memory. Owens has 16 hugemem nodes
+          with 48 cores and 1.5 TB of RAM. Pitzer has 4 hugemem nodes with 3 TB of RAM and 80 cores.
+          Pitzer also has 12 Largmem nodes which have 48 cores with 768 GB of RAM.
+
+        [NVIDIA Tesla P100 GPU]: http://www.nvidia.com/object/tesla-p100.html
+        [NVIDIA Tesla V100 GPUs]: https://www.nvidia.com/en-us/data-center/v100/
+      options:
+        - [
+            "any",     "any",
+            data-max-num-cores-for-cluster-owens: 28,
+            data-max-num-cores-for-cluster-pitzer: 48,
+          ]
+        - [
+            "40 core",     "any-40core",
+            data-max-num-cores-for-cluster-pitzer: 40,
+            data-option-for-cluster-owens: false,
+          ]
+        - [
+            "48 core",     "any-48core",
+            data-max-num-cores-for-cluster-pitzer: 48,
+            data-option-for-cluster-owens: false,
+          ]
+        - [
+            "any gpu",     "gpu",
+            data-max-num-cores-for-cluster-owens: 28,
+            data-max-num-cores-for-cluster-pitzer: 48,
+          ]
+        - [
+            "40 core gpu",     "gpu-40core",
+            data-max-num-cores-for-cluster-pitzer: 40,
+            data-option-for-cluster-owens: false,
+          ]
+        - [
+            "48 core gpu",     "gpu-48core",
+            data-max-num-cores-for-cluster-pitzer: 48,
+            data-option-for-cluster-owens: false,
+          ]
+        - [
+            "largemem", "largemem",
+            data-min-num-cores-for-cluster-pitzer: 48,
+            data-max-num-cores-for-cluster-pitzer: 48,
+            data-option-for-cluster-owens: false,
+          ]
+        - [
+            "hugemem", "hugemem",
+            data-min-num-cores-for-cluster-owens: 48,
+            data-max-num-cores-for-cluster-owens: 48,
+            data-min-num-cores-for-cluster-pitzer: 80,
+            data-max-num-cores-for-cluster-pitzer: 80,
+          ]
+        - [
+            "debug",   "debug",
+            data-max-num-cores-for-cluster-owens: 28,
+            data-max-num-cores-for-cluster-pitzer: 48,
+            data-option-for-cluster-owens: false,
+            data-option-for-cluster-pitzer: false,
+          ]
   version:
     widget: select
     label: "MATLAB version"
     help: "This defines the version of MATLAB you want to load."
     options:
-      - [ "R2019b", "matlab/r2019b" ]
-      - [ "R2018b", "matlab/r2018b" ]
-      - [ "R2018a", "matlab/r2018a" ]
-      - [ "R2017a", "matlab/r2017a" ]
-      - [ "R2016b", "matlab/r2016b" ]
-      - [ "R2015b", "matlab/r2015b" ]
+      - [ 
+          "R2020a", "matlab/r2020a",           
+        ]    
+      - [ 
+          "R2019b", "matlab/r2019b",           
+        ]    
+      - [ 
+          "R2019a", "matlab/r2019a",           
+          data-option-for-cluster-owens: false,
+        ]    
+      - [ 
+          "R2018b", "matlab/r2018b" 
+        ]
+      - [ 
+          "R2018a", "matlab/r2018a" 
+        ]
+      - [ 
+          "R2017a", "matlab/r2017a",
+          data-option-for-cluster-pitzer: false, 
+        ]
+      - [ 
+          "R2016b", "matlab/r2016b",
+          data-option-for-cluster-pitzer: false,
+        ]
+      - [ 
+          "R2015b", "matlab/r2015b" ,
+          data-option-for-cluster-pitzer: false,
+        ]
-- 
GitLab