|
| 1 | +// Copyright Common Workflow Language project contributors |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +package org.commonwl.cwlsdk.cwl1_2; |
| 16 | + |
| 17 | +import org.commonwl.cwlsdk.cwl1_2.utils.LoaderInstances; |
| 18 | +import org.commonwl.cwlsdk.cwl1_2.utils.LoadingOptions; |
| 19 | +import org.commonwl.cwlsdk.cwl1_2.utils.LoadingOptionsBuilder; |
| 20 | +import org.commonwl.cwlsdk.cwl1_2.utils.SaveableImpl; |
| 21 | +import org.commonwl.cwlsdk.cwl1_2.utils.ValidationException; |
| 22 | + |
| 23 | +/** |
| 24 | +* Auto-generated class implementation for <I>http://commonwl.org/cwltool#CUDARequirement</I><BR> <BLOCKQUOTE> |
| 25 | + Require support for NVIDA CUDA (GPU hardware acceleration). |
| 26 | + </BLOCKQUOTE> |
| 27 | + */ |
| 28 | +public class CUDARequirementImpl extends SaveableImpl implements CUDARequirement { |
| 29 | + private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build(); |
| 30 | + private java.util.Map<String, Object> extensionFields_ = |
| 31 | + new java.util.HashMap<String, Object>(); |
| 32 | + public LoadingOptions getLoadingOptions() { |
| 33 | + return this.loadingOptions_; |
| 34 | + } |
| 35 | + public java.util.Map<String, Object> getExtensionFields() { |
| 36 | + return this.extensionFields_; |
| 37 | + } |
| 38 | + |
| 39 | + private String class_; |
| 40 | + |
| 41 | + /** |
| 42 | + * Getter for property <I>http://commonwl.org/cwltool#CUDARequirement/class</I><BR> |
| 43 | + * <BLOCKQUOTE> |
| 44 | + * cwltool:CUDARequirement * </BLOCKQUOTE> |
| 45 | + */ |
| 46 | + |
| 47 | + public String getClass_() { |
| 48 | + return this.class_; |
| 49 | + } |
| 50 | + |
| 51 | + private Object cudaComputeCapability; |
| 52 | + |
| 53 | + /** |
| 54 | + * Getter for property <I>http://commonwl.org/cwltool#CUDARequirement/cudaComputeCapability</I><BR> |
| 55 | + * <BLOCKQUOTE> |
| 56 | + * CUDA hardware capability required to run the software, in X.Y |
| 57 | + * format. |
| 58 | + * |
| 59 | + * * If this is a single value, it defines only the minimum |
| 60 | + * compute capability. GPUs with higher capability are also |
| 61 | + * accepted. |
| 62 | + * |
| 63 | + * * If it is an array value, then only select GPUs with compute |
| 64 | + * capabilities that explicitly appear in the array. |
| 65 | + * * </BLOCKQUOTE> |
| 66 | + */ |
| 67 | + |
| 68 | + public Object getCudaComputeCapability() { |
| 69 | + return this.cudaComputeCapability; |
| 70 | + } |
| 71 | + |
| 72 | + private Object cudaDeviceCountMax; |
| 73 | + |
| 74 | + /** |
| 75 | + * Getter for property <I>http://commonwl.org/cwltool#CUDARequirement/cudaDeviceCountMax</I><BR> |
| 76 | + * <BLOCKQUOTE> |
| 77 | + * Maximum number of GPU devices to request. If not specified, |
| 78 | + * same as `cudaDeviceCountMin`. |
| 79 | + * * </BLOCKQUOTE> |
| 80 | + */ |
| 81 | + |
| 82 | + public Object getCudaDeviceCountMax() { |
| 83 | + return this.cudaDeviceCountMax; |
| 84 | + } |
| 85 | + |
| 86 | + private Object cudaDeviceCountMin; |
| 87 | + |
| 88 | + /** |
| 89 | + * Getter for property <I>http://commonwl.org/cwltool#CUDARequirement/cudaDeviceCountMin</I><BR> |
| 90 | + * <BLOCKQUOTE> |
| 91 | + * Minimum number of GPU devices to request. If not specified, |
| 92 | + * same as `cudaDeviceCountMax`. If neither are specified, |
| 93 | + * default 1. |
| 94 | + * * </BLOCKQUOTE> |
| 95 | + */ |
| 96 | + |
| 97 | + public Object getCudaDeviceCountMin() { |
| 98 | + return this.cudaDeviceCountMin; |
| 99 | + } |
| 100 | + |
| 101 | + private String cudaVersionMin; |
| 102 | + |
| 103 | + /** |
| 104 | + * Getter for property <I>http://commonwl.org/cwltool#CUDARequirement/cudaVersionMin</I><BR> |
| 105 | + * <BLOCKQUOTE> |
| 106 | + * Minimum CUDA version to run the software, in X.Y format. This |
| 107 | + * corresponds to a CUDA SDK release. When running directly on |
| 108 | + * the host (not in a container) the host must have a compatible |
| 109 | + * CUDA SDK (matching the exact version, or, starting with CUDA |
| 110 | + * 11.3, matching major version). When run in a container, the |
| 111 | + * container image should provide the CUDA runtime, and the host |
| 112 | + * driver is injected into the container. In this case, because |
| 113 | + * CUDA drivers are backwards compatible, it is possible to |
| 114 | + * use an older SDK with a newer driver across major versions. |
| 115 | + * |
| 116 | + * See https://docs.nvidia.com/deploy/cuda-compatibility/ for |
| 117 | + * details. |
| 118 | + * * </BLOCKQUOTE> |
| 119 | + */ |
| 120 | + |
| 121 | + public String getCudaVersionMin() { |
| 122 | + return this.cudaVersionMin; |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * Used by {@link org.commonwl.cwlsdk.cwl1_2.utils.RootLoader} to construct instances of CUDARequirementImpl. |
| 127 | + * |
| 128 | + * @param __doc_ Document fragment to load this record object from (presumably a |
| 129 | + {@link java.util.Map}). |
| 130 | + * @param __baseUri_ Base URI to generate child document IDs against. |
| 131 | + * @param __loadingOptions Context for loading URIs and populating objects. |
| 132 | + * @param __docRoot_ ID at this position in the document (if available) (maybe?) |
| 133 | + * @throws ValidationException If the document fragment is not a {@link java.util.Map} |
| 134 | + * or validation of fields fails. |
| 135 | + */ |
| 136 | + public CUDARequirementImpl( |
| 137 | + final Object __doc_, |
| 138 | + final String __baseUri_, |
| 139 | + LoadingOptions __loadingOptions, |
| 140 | + final String __docRoot_) { |
| 141 | + super(__doc_, __baseUri_, __loadingOptions, __docRoot_); |
| 142 | + // Prefix plumbing variables with '__' to reduce likelihood of collision with |
| 143 | + // generated names. |
| 144 | + String __baseUri = __baseUri_; |
| 145 | + String __docRoot = __docRoot_; |
| 146 | + if (!(__doc_ instanceof java.util.Map)) { |
| 147 | + throw new ValidationException("CUDARequirementImpl called on non-map"); |
| 148 | + } |
| 149 | + final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_; |
| 150 | + final java.util.List<ValidationException> __errors = |
| 151 | + new java.util.ArrayList<ValidationException>(); |
| 152 | + if (__loadingOptions != null) { |
| 153 | + this.loadingOptions_ = __loadingOptions; |
| 154 | + } |
| 155 | + String class_; |
| 156 | + try { |
| 157 | + class_ = |
| 158 | + LoaderInstances |
| 159 | + .uri_StringInstance_False_True_None_None |
| 160 | + .loadField(__doc.get("class"), __baseUri, __loadingOptions); |
| 161 | + } catch (ValidationException e) { |
| 162 | + class_ = null; // won't be used but prevents compiler from complaining. |
| 163 | + final String __message = "the `class` field is not valid because:"; |
| 164 | + __errors.add(new ValidationException(__message, e)); |
| 165 | + } |
| 166 | + Object cudaComputeCapability; |
| 167 | + try { |
| 168 | + cudaComputeCapability = |
| 169 | + LoaderInstances |
| 170 | + .union_of_StringInstance_or_array_of_StringInstance |
| 171 | + .loadField(__doc.get("cudaComputeCapability"), __baseUri, __loadingOptions); |
| 172 | + } catch (ValidationException e) { |
| 173 | + cudaComputeCapability = null; // won't be used but prevents compiler from complaining. |
| 174 | + final String __message = "the `cudaComputeCapability` field is not valid because:"; |
| 175 | + __errors.add(new ValidationException(__message, e)); |
| 176 | + } |
| 177 | + Object cudaDeviceCountMax; |
| 178 | + |
| 179 | + if (__doc.containsKey("cudaDeviceCountMax")) { |
| 180 | + try { |
| 181 | + cudaDeviceCountMax = |
| 182 | + LoaderInstances |
| 183 | + .union_of_NullInstance_or_IntegerInstance_or_ExpressionLoader |
| 184 | + .loadField(__doc.get("cudaDeviceCountMax"), __baseUri, __loadingOptions); |
| 185 | + } catch (ValidationException e) { |
| 186 | + cudaDeviceCountMax = null; // won't be used but prevents compiler from complaining. |
| 187 | + final String __message = "the `cudaDeviceCountMax` field is not valid because:"; |
| 188 | + __errors.add(new ValidationException(__message, e)); |
| 189 | + } |
| 190 | + |
| 191 | + } else { |
| 192 | + cudaDeviceCountMax = null; |
| 193 | + } |
| 194 | + Object cudaDeviceCountMin; |
| 195 | + |
| 196 | + if (__doc.containsKey("cudaDeviceCountMin")) { |
| 197 | + try { |
| 198 | + cudaDeviceCountMin = |
| 199 | + LoaderInstances |
| 200 | + .union_of_NullInstance_or_IntegerInstance_or_ExpressionLoader |
| 201 | + .loadField(__doc.get("cudaDeviceCountMin"), __baseUri, __loadingOptions); |
| 202 | + } catch (ValidationException e) { |
| 203 | + cudaDeviceCountMin = null; // won't be used but prevents compiler from complaining. |
| 204 | + final String __message = "the `cudaDeviceCountMin` field is not valid because:"; |
| 205 | + __errors.add(new ValidationException(__message, e)); |
| 206 | + } |
| 207 | + |
| 208 | + } else { |
| 209 | + cudaDeviceCountMin = null; |
| 210 | + } |
| 211 | + String cudaVersionMin; |
| 212 | + try { |
| 213 | + cudaVersionMin = |
| 214 | + LoaderInstances |
| 215 | + .StringInstance |
| 216 | + .loadField(__doc.get("cudaVersionMin"), __baseUri, __loadingOptions); |
| 217 | + } catch (ValidationException e) { |
| 218 | + cudaVersionMin = null; // won't be used but prevents compiler from complaining. |
| 219 | + final String __message = "the `cudaVersionMin` field is not valid because:"; |
| 220 | + __errors.add(new ValidationException(__message, e)); |
| 221 | + } |
| 222 | + if (!__errors.isEmpty()) { |
| 223 | + throw new ValidationException("Trying 'RecordField'", __errors); |
| 224 | + } |
| 225 | + this.class_ = (String) class_; |
| 226 | + this.cudaComputeCapability = (Object) cudaComputeCapability; |
| 227 | + this.cudaDeviceCountMax = (Object) cudaDeviceCountMax; |
| 228 | + this.cudaDeviceCountMin = (Object) cudaDeviceCountMin; |
| 229 | + this.cudaVersionMin = (String) cudaVersionMin; |
| 230 | + for (String field:__doc.keySet()) { |
| 231 | + if (!attrs.contains(field)) { |
| 232 | + if (field.contains(":")) { |
| 233 | + String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null); |
| 234 | + extensionFields_.put(expanded_field, __doc.get(field)); |
| 235 | + } |
| 236 | + } |
| 237 | + } |
| 238 | + } |
| 239 | + private java.util.List<String> attrs = java.util.Arrays.asList("class", "cudaComputeCapability", "cudaDeviceCountMax", "cudaDeviceCountMin", "cudaVersionMin"); |
| 240 | +} |
0 commit comments