Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/jcl/src/openj9.cuda/share/classes/com/ibm/cuda/CudaPermission.java
12923 views
1
/*[INCLUDE-IF Sidecar18-SE]*/
2
/*******************************************************************************
3
* Copyright (c) 2014, 2021 IBM Corp. and others
4
*
5
* This program and the accompanying materials are made available under
6
* the terms of the Eclipse Public License 2.0 which accompanies this
7
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8
* or the Apache License, Version 2.0 which accompanies this distribution and
9
* is available at https://www.apache.org/licenses/LICENSE-2.0.
10
*
11
* This Source Code may also be made available under the following
12
* Secondary Licenses when the conditions for such availability set
13
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14
* General Public License, version 2 with the GNU Classpath
15
* Exception [1] and GNU General Public License, version 2 with the
16
* OpenJDK Assembly Exception [2].
17
*
18
* [1] https://www.gnu.org/software/classpath/license.html
19
* [2] http://openjdk.java.net/legal/assembly-exception.html
20
*
21
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
22
*******************************************************************************/
23
package com.ibm.cuda;
24
25
import java.security.BasicPermission;
26
import java.security.Permission;
27
28
import com.ibm.cuda.CudaDevice.CacheConfig;
29
import com.ibm.cuda.CudaDevice.Limit;
30
import com.ibm.cuda.CudaDevice.SharedMemConfig;
31
32
/**
33
* This class defines CUDA permissions as described in the following table.
34
*
35
* <table border=1 style="padding:5px">
36
* <caption>CUDA Permissions</caption>
37
* <tr>
38
* <th style="text-align:left">Permission Name</th>
39
* <th style="text-align:left">Allowed Action</th>
40
* </tr>
41
* <tr>
42
* <td>configureDeviceCache</td>
43
* <td>Configuring the cache of a device.
44
* See {@link CudaDevice#setCacheConfig(CacheConfig)}.</td>
45
* </tr>
46
* <tr>
47
* <td>configureDeviceSharedMemory</td>
48
* <td>Configuring the shared memory of a device.
49
* See {@link CudaDevice#setSharedMemConfig(SharedMemConfig)}.</td>
50
* </tr>
51
* <tr>
52
* <td>loadModule</td>
53
* <td>Loading a GPU code module onto a device.
54
* See {@link CudaModule}.</td>
55
* </tr>
56
* <tr>
57
* <td>peerAccess.disable</td> <td>Disabling peer access from one device to another.
58
* See {@link CudaDevice#disablePeerAccess(CudaDevice)}.</td>
59
* </tr>
60
* <tr>
61
* <td>peerAccess.enable</td>
62
* <td>Enabling peer access from one device to another.
63
* See {@link CudaDevice#enablePeerAccess(CudaDevice)}.</td>
64
* </tr>
65
* <tr>
66
* <td>setDeviceLimit</td>
67
* <td>Setting a device limit.
68
* See {@link CudaDevice#setLimit(Limit, long)}.</td>
69
* </tr>
70
* </table>
71
*/
72
public final class CudaPermission extends BasicPermission {
73
74
private static final long serialVersionUID = 5769765985242116236L;
75
76
static final Permission DisablePeerAccess = new CudaPermission("peerAccess.disable"); //$NON-NLS-1$
77
78
static final Permission EnablePeerAccess = new CudaPermission("peerAccess.enable"); //$NON-NLS-1$
79
80
static final Permission LoadModule = new CudaPermission("loadModule"); //$NON-NLS-1$
81
82
static final Permission SetCacheConfig = new CudaPermission("configureDeviceCache"); //$NON-NLS-1$
83
84
static final Permission SetLimit = new CudaPermission("setDeviceLimit"); //$NON-NLS-1$
85
86
static final Permission SetSharedMemConfig = new CudaPermission("configureDeviceSharedMemory"); //$NON-NLS-1$
87
88
/**
89
* Create a representation of the named permissions.
90
*
91
* @param name
92
* name of the permission
93
*/
94
public CudaPermission(String name) {
95
super(name);
96
}
97
98
/**
99
* Create a representation of the named permissions.
100
*
101
* @param name
102
* name of the permission
103
* @param actions
104
* not used, must be null or an empty string
105
* @throws IllegalArgumentException
106
* if actions is not null or an empty string
107
*/
108
public CudaPermission(String name, String actions) {
109
super(name, actions);
110
111
// ensure that actions is null or an empty string
112
if (!((null == actions) || actions.isEmpty())) {
113
throw new IllegalArgumentException();
114
}
115
}
116
}
117
118