Path: blob/master/jcl/src/openj9.cuda/share/classes/com/ibm/cuda/CudaPermission.java
12923 views
/*[INCLUDE-IF Sidecar18-SE]*/1/*******************************************************************************2* Copyright (c) 2014, 2021 IBM Corp. and others3*4* This program and the accompanying materials are made available under5* the terms of the Eclipse Public License 2.0 which accompanies this6* distribution and is available at https://www.eclipse.org/legal/epl-2.0/7* or the Apache License, Version 2.0 which accompanies this distribution and8* is available at https://www.apache.org/licenses/LICENSE-2.0.9*10* This Source Code may also be made available under the following11* Secondary Licenses when the conditions for such availability set12* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU13* General Public License, version 2 with the GNU Classpath14* Exception [1] and GNU General Public License, version 2 with the15* OpenJDK Assembly Exception [2].16*17* [1] https://www.gnu.org/software/classpath/license.html18* [2] http://openjdk.java.net/legal/assembly-exception.html19*20* 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-exception21*******************************************************************************/22package com.ibm.cuda;2324import java.security.BasicPermission;25import java.security.Permission;2627import com.ibm.cuda.CudaDevice.CacheConfig;28import com.ibm.cuda.CudaDevice.Limit;29import com.ibm.cuda.CudaDevice.SharedMemConfig;3031/**32* This class defines CUDA permissions as described in the following table.33*34* <table border=1 style="padding:5px">35* <caption>CUDA Permissions</caption>36* <tr>37* <th style="text-align:left">Permission Name</th>38* <th style="text-align:left">Allowed Action</th>39* </tr>40* <tr>41* <td>configureDeviceCache</td>42* <td>Configuring the cache of a device.43* See {@link CudaDevice#setCacheConfig(CacheConfig)}.</td>44* </tr>45* <tr>46* <td>configureDeviceSharedMemory</td>47* <td>Configuring the shared memory of a device.48* See {@link CudaDevice#setSharedMemConfig(SharedMemConfig)}.</td>49* </tr>50* <tr>51* <td>loadModule</td>52* <td>Loading a GPU code module onto a device.53* See {@link CudaModule}.</td>54* </tr>55* <tr>56* <td>peerAccess.disable</td> <td>Disabling peer access from one device to another.57* See {@link CudaDevice#disablePeerAccess(CudaDevice)}.</td>58* </tr>59* <tr>60* <td>peerAccess.enable</td>61* <td>Enabling peer access from one device to another.62* See {@link CudaDevice#enablePeerAccess(CudaDevice)}.</td>63* </tr>64* <tr>65* <td>setDeviceLimit</td>66* <td>Setting a device limit.67* See {@link CudaDevice#setLimit(Limit, long)}.</td>68* </tr>69* </table>70*/71public final class CudaPermission extends BasicPermission {7273private static final long serialVersionUID = 5769765985242116236L;7475static final Permission DisablePeerAccess = new CudaPermission("peerAccess.disable"); //$NON-NLS-1$7677static final Permission EnablePeerAccess = new CudaPermission("peerAccess.enable"); //$NON-NLS-1$7879static final Permission LoadModule = new CudaPermission("loadModule"); //$NON-NLS-1$8081static final Permission SetCacheConfig = new CudaPermission("configureDeviceCache"); //$NON-NLS-1$8283static final Permission SetLimit = new CudaPermission("setDeviceLimit"); //$NON-NLS-1$8485static final Permission SetSharedMemConfig = new CudaPermission("configureDeviceSharedMemory"); //$NON-NLS-1$8687/**88* Create a representation of the named permissions.89*90* @param name91* name of the permission92*/93public CudaPermission(String name) {94super(name);95}9697/**98* Create a representation of the named permissions.99*100* @param name101* name of the permission102* @param actions103* not used, must be null or an empty string104* @throws IllegalArgumentException105* if actions is not null or an empty string106*/107public CudaPermission(String name, String actions) {108super(name, actions);109110// ensure that actions is null or an empty string111if (!((null == actions) || actions.isEmpty())) {112throw new IllegalArgumentException();113}114}115}116117118