idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
4,000
static BeanDefinitionBuilder startClientBuilder ( Class beanClass , String properties , boolean forceMapping , boolean forceTemplate , boolean mergeMapping , boolean mergeSettings , boolean autoscan , String classpathRoot , String mappings , String aliases , String templates , String async , String taskExecutor ) { BeanDefinitionBuilder nodeFactory = BeanDefinitionBuilder . rootBeanDefinition ( beanClass ) ; if ( properties != null && properties . length ( ) > 0 ) { nodeFactory . addPropertyReference ( "properties" , properties ) ; } nodeFactory . addPropertyValue ( "forceMapping" , forceMapping ) ; nodeFactory . addPropertyValue ( "forceTemplate" , forceTemplate ) ; nodeFactory . addPropertyValue ( "mergeMapping" , mergeMapping ) ; nodeFactory . addPropertyValue ( "mergeSettings" , mergeSettings ) ; nodeFactory . addPropertyValue ( "autoscan" , autoscan ) ; if ( classpathRoot != null && classpathRoot . length ( ) > 0 ) { nodeFactory . addPropertyValue ( "classpathRoot" , classpathRoot ) ; } if ( mappings != null && mappings . length ( ) > 0 ) { nodeFactory . addPropertyValue ( "mappings" , mappings ) ; } if ( aliases != null && aliases . length ( ) > 0 ) { nodeFactory . addPropertyValue ( "aliases" , aliases ) ; } if ( templates != null && templates . length ( ) > 0 ) { nodeFactory . addPropertyValue ( "templates" , templates ) ; } if ( async != null && async . length ( ) > 0 ) { nodeFactory . addPropertyValue ( "async" , async ) ; } if ( taskExecutor != null && taskExecutor . length ( ) > 0 ) { nodeFactory . addPropertyReference ( "taskExecutor" , taskExecutor ) ; } return nodeFactory ; }
Managing common properties for TransportClient
4,001
private String getAdaptiveUrl ( FileLink fileLink , int dimen ) { ResizeTask resizeTask = new ResizeTask . Builder ( ) . fit ( "crop" ) . align ( "center" ) . width ( dimen ) . height ( dimen ) . build ( ) ; return fileLink . imageTransform ( ) . addTask ( resizeTask ) . url ( ) ; }
Creates a URL to an image sized appropriately for the form ImageView
4,002
private void selectImage ( ) { String apiKey = getString ( R . string . filestack_api_key ) ; if ( apiKey . equals ( "" ) ) { throw new RuntimeException ( "Create a string res value for \"filestack_api_key\"" ) ; } Config config = new Config ( apiKey , "https://form.samples.android.filestack.com" ) ; Context context = getContext ( ) ; Intent pickerIntent = new Intent ( context , FsActivity . class ) ; pickerIntent . putExtra ( FsConstants . EXTRA_CONFIG , config ) ; String [ ] mimeTypes = { "image/*" } ; pickerIntent . putExtra ( FsConstants . EXTRA_MIME_TYPES , mimeTypes ) ; context . startActivity ( pickerIntent ) ; ( ( MainActivity ) getActivity ( ) ) . setLoading ( true ) ; }
Handles user clicking select button launches the picker UI
4,003
private void createAccount ( ) { String name = nameView . getText ( ) . toString ( ) ; ( ( MainActivity ) getActivity ( ) ) . setComplete ( name ) ; }
Handles user clicking create button calls on activity to handle swapping fragments
4,004
public static String trimLastPathSection ( String path ) { String [ ] sections = path . split ( "/" ) ; StringBuilder newPath = new StringBuilder ( "/" ) ; for ( int i = 1 ; i < sections . length - 1 ; i ++ ) { newPath . append ( sections [ i ] ) . append ( "/" ) ; } return newPath . toString ( ) ; }
Removes the last part of a file path .
4,005
public static File createPictureFile ( Context context ) throws IOException { Locale locale = Locale . getDefault ( ) ; String timeStamp = new SimpleDateFormat ( "yyyyMMdd_HHmmss" , locale ) . format ( new Date ( ) ) ; String fileName = "JPEG_" + timeStamp + "_" ; File storageDir = context . getExternalFilesDir ( Environment . DIRECTORY_PICTURES ) ; return File . createTempFile ( fileName , ".jpg" , storageDir ) ; }
Create a file with a path appropriate to save a photo . Uses directory internal to app .
4,006
public static void addMediaToGallery ( Context context , String path ) { Intent mediaScanIntent = new Intent ( Intent . ACTION_MEDIA_SCANNER_SCAN_FILE ) ; File f = new File ( path ) ; Uri contentUri = Uri . fromFile ( f ) ; mediaScanIntent . setData ( contentUri ) ; context . sendBroadcast ( mediaScanIntent ) ; }
Make media accessible outside the app .
4,007
public static void initializeClient ( Config config , String sessionToken ) { Config overridenConfig = new Config ( config . getApiKey ( ) , "filestack://done" , config . getPolicy ( ) , config . getSignature ( ) ) ; client = new Client ( overridenConfig ) ; client . setSessionToken ( sessionToken ) ; }
Create the Java SDK client and set a session token . The token maintains cloud auth state .
4,008
public static boolean mimeAllowed ( String [ ] filters , String mimeType ) { return MimeTypeFilter . matches ( mimeType , filters ) != null ; }
Returns true if the MIME type is allowed by the filters .
4,009
public void setLoading ( boolean isLoading ) { getSupportFragmentManager ( ) . beginTransaction ( ) . replace ( R . id . root , isLoading ? loadingFragment : formFragment ) . commit ( ) ; }
Swap between showing the form and loading fragments
4,010
public void setComplete ( String name ) { CompleteFragment fragment = CompleteFragment . create ( name ) ; getSupportFragmentManager ( ) . beginTransaction ( ) . replace ( R . id . root , fragment ) . commit ( ) ; }
Show the complete fragment when an account has been created
4,011
public void reset ( ) { fileLink = null ; formFragment = new FormFragment ( ) ; getSupportFragmentManager ( ) . beginTransaction ( ) . replace ( R . id . root , formFragment ) . commit ( ) ; }
Remove the complete fragment and show an empty form fragment
4,012
void saveState ( Bundle outState ) { outState . putString ( STATE_CURRENT_PATH , currentPath ) ; outState . putSerializable ( STATE_FOLDERS , folders ) ; outState . putSerializable ( STATE_NEXT_TOKENS , nextTokens ) ; }
Save the items we ve loaded on orientation changes etc
4,013
public boolean hasSubscriptions ( ) { return ! disposedInd && ( ( bindings != null && ! bindings . isEmpty ( ) ) || ( compBindings != null && ! compBindings . isEmpty ( ) ) ) ; }
Returns true if this composite is not disposed and contains Bindings .
4,014
public static < T > FlowableTransformer < T , T > doOnErrorFx ( Consumer < Throwable > onError ) { return obs -> obs . doOnError ( e -> runOnFx ( e , onError ) ) ; }
Performs a given action on a Throwable on the FX thread in the event of an onError
4,015
public static < T > FlowableTransformer < T , T > doOnNextCountFx ( Consumer < Integer > onNext ) { return obs -> obs . compose ( doOnNextCount ( i -> runOnFx ( i , onNext ) ) ) ; }
Performs an action on FX thread on onNext with the provided emission count
4,016
public static < T > FlowableTransformer < T , T > doOnCompleteCountFx ( Consumer < Integer > onComplete ) { return obs -> obs . compose ( doOnCompleteCount ( i -> runOnFx ( i , onComplete ) ) ) ; }
Performs an action on FX thread on onCompleted with the provided emission count
4,017
public static < T > ObservableTransformer < T , T > doOnNextFx ( Consumer < T > onNext ) { return obs -> obs . doOnNext ( t -> runOnFx ( t , onNext ) ) ; }
Performs a given action for each item on the FX thread
4,018
public static < T > ObservableTransformer < T , T > doOnErrorCountFx ( Consumer < Integer > onError ) { return obs -> obs . compose ( doOnErrorCount ( i -> runOnFx ( i , onError ) ) ) ; }
Performs an action on FX thread on onError with the provided emission count
4,019
private static int checkResult ( int result ) { if ( exceptionsEnabled && result != cudaError . cudaSuccess ) { throw new CudaException ( cudaError . stringFor ( result ) ) ; } return result ; }
If the given result is different to cudaError . cudaSuccess and exceptions have been enabled this method will throw a CudaException with an error message that corresponds to the given result code . Otherwise the given result is simply returned .
4,020
public static int cudaMallocMipmappedArray ( cudaMipmappedArray mipmappedArray , cudaChannelFormatDesc desc , cudaExtent extent , int numLevels , int flags ) { return checkResult ( cudaMallocMipmappedArrayNative ( mipmappedArray , desc , extent , numLevels , flags ) ) ; }
Allocate a mipmapped array on the device .
4,021
public static int cudaArrayGetInfo ( cudaChannelFormatDesc desc , cudaExtent extent , int flags [ ] , cudaArray array ) { return checkResult ( cudaArrayGetInfoNative ( desc , extent , flags , array ) ) ; }
Gets info about the specified cudaArray .
4,022
public static int cudaHostAlloc ( Pointer ptr , long size , int flags ) { return checkResult ( cudaHostAllocNative ( ptr , size , flags ) ) ; }
Allocates page - locked memory on the host .
4,023
public static int cudaHostGetDevicePointer ( Pointer pDevice , Pointer pHost , int flags ) { return checkResult ( cudaHostGetDevicePointerNative ( pDevice , pHost , flags ) ) ; }
Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister .
4,024
public static int cudaMallocPitch ( Pointer devPtr , long pitch [ ] , long width , long height ) { return checkResult ( cudaMallocPitchNative ( devPtr , pitch , width , height ) ) ; }
Allocates pitched memory on the device .
4,025
public static int cudaMemcpyPeer ( Pointer dst , int dstDevice , Pointer src , int srcDevice , long count ) { return checkResult ( cudaMemcpyPeerNative ( dst , dstDevice , src , srcDevice , count ) ) ; }
Copies memory between two devices .
4,026
public static int cudaMemcpyPeerAsync ( Pointer dst , int dstDevice , Pointer src , int srcDevice , long count , cudaStream_t stream ) { return checkResult ( cudaMemcpyPeerAsyncNative ( dst , dstDevice , src , srcDevice , count , stream ) ) ; }
Copies memory between two devices asynchronously .
4,027
public static int cudaEventElapsedTime ( float ms [ ] , cudaEvent_t start , cudaEvent_t end ) { return checkResult ( cudaEventElapsedTimeNative ( ms , start , end ) ) ; }
Computes the elapsed time between events .
4,028
public static int cudaConfigureCall ( dim3 gridDim , dim3 blockDim , long sharedMem , cudaStream_t stream ) { return checkResult ( cudaConfigureCallNative ( gridDim , blockDim , sharedMem , stream ) ) ; }
Configure a device - launch .
4,029
public static int cudaGLMapBufferObjectAsync ( Pointer devPtr , int bufObj , cudaStream_t stream ) { return checkResult ( cudaGLMapBufferObjectAsyncNative ( devPtr , bufObj , stream ) ) ; }
Maps a buffer object for access by CUDA .
4,030
public static int cudaGraphicsResourceGetMappedPointer ( Pointer devPtr , long size [ ] , cudaGraphicsResource resource ) { return checkResult ( cudaGraphicsResourceGetMappedPointerNative ( devPtr , size , resource ) ) ; }
Get an device pointer through which to access a mapped graphics resource .
4,031
public static int cudaProfilerInitialize ( String configFile , String outputFile , int outputMode ) { return checkResult ( cudaProfilerInitializeNative ( configFile , outputFile , outputMode ) ) ; }
Initialize the CUDA profiler .
4,032
private static int computePointerSize ( ) { String bits = System . getProperty ( "sun.arch.data.model" ) ; if ( bits . equals ( "32" ) ) { return 4 ; } else if ( bits . equals ( "64" ) ) { return 8 ; } else { System . err . println ( "Unknown value for sun.arch.data.model - assuming 32 bits" ) ; return 4 ; } }
Computes the size of a pointer in bytes
4,033
public static String stringFor ( int n ) { if ( n == 0 ) { return "CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE" ; } String result = "" ; if ( ( n & CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY ) != 0 ) result += "CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY " ; if ( ( n & CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD ) != 0 ) result += "CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD " ; return result ; }
Returns the String identifying the given CUgraphicsMapResourceFlags
4,034
public static String stringFor ( int n ) { if ( n == 0 ) { return "CU_STREAM_WAIT_VALUE_GEQ" ; } String result = "" ; if ( ( n & CU_STREAM_WAIT_VALUE_EQ ) != 0 ) result += "CU_STREAM_WAIT_VALUE_EQ " ; if ( ( n & CU_STREAM_WAIT_VALUE_AND ) != 0 ) result += "CU_STREAM_WAIT_VALUE_AND " ; if ( ( n & CU_STREAM_WAIT_VALUE_NOR ) != 0 ) result += "CU_STREAM_WAIT_VALUE_NOR " ; if ( ( n & CU_STREAM_WAIT_VALUE_FLUSH ) != 0 ) result += "CU_STREAM_WAIT_VALUE_FLUSH " ; return result ; }
Returns the String identifying the given CUstreamWaitValue_flags
4,035
public static String stringFor ( int n ) { switch ( n ) { case CU_RES_VIEW_FORMAT_NONE : return "CU_RES_VIEW_FORMAT_NONE" ; case CU_RES_VIEW_FORMAT_UINT_1X8 : return "CU_RES_VIEW_FORMAT_UINT_1X8" ; case CU_RES_VIEW_FORMAT_UINT_2X8 : return "CU_RES_VIEW_FORMAT_UINT_2X8" ; case CU_RES_VIEW_FORMAT_UINT_4X8 : return "CU_RES_VIEW_FORMAT_UINT_4X8" ; case CU_RES_VIEW_FORMAT_SINT_1X8 : return "CU_RES_VIEW_FORMAT_SINT_1X8" ; case CU_RES_VIEW_FORMAT_SINT_2X8 : return "CU_RES_VIEW_FORMAT_SINT_2X8" ; case CU_RES_VIEW_FORMAT_SINT_4X8 : return "CU_RES_VIEW_FORMAT_SINT_4X8" ; case CU_RES_VIEW_FORMAT_UINT_1X16 : return "CU_RES_VIEW_FORMAT_UINT_1X16" ; case CU_RES_VIEW_FORMAT_UINT_2X16 : return "CU_RES_VIEW_FORMAT_UINT_2X16" ; case CU_RES_VIEW_FORMAT_UINT_4X16 : return "CU_RES_VIEW_FORMAT_UINT_4X16" ; case CU_RES_VIEW_FORMAT_SINT_1X16 : return "CU_RES_VIEW_FORMAT_SINT_1X16" ; case CU_RES_VIEW_FORMAT_SINT_2X16 : return "CU_RES_VIEW_FORMAT_SINT_2X16" ; case CU_RES_VIEW_FORMAT_SINT_4X16 : return "CU_RES_VIEW_FORMAT_SINT_4X16" ; case CU_RES_VIEW_FORMAT_UINT_1X32 : return "CU_RES_VIEW_FORMAT_UINT_1X32" ; case CU_RES_VIEW_FORMAT_UINT_2X32 : return "CU_RES_VIEW_FORMAT_UINT_2X32" ; case CU_RES_VIEW_FORMAT_UINT_4X32 : return "CU_RES_VIEW_FORMAT_UINT_4X32" ; case CU_RES_VIEW_FORMAT_SINT_1X32 : return "CU_RES_VIEW_FORMAT_SINT_1X32" ; case CU_RES_VIEW_FORMAT_SINT_2X32 : return "CU_RES_VIEW_FORMAT_SINT_2X32" ; case CU_RES_VIEW_FORMAT_SINT_4X32 : return "CU_RES_VIEW_FORMAT_SINT_4X32" ; case CU_RES_VIEW_FORMAT_FLOAT_1X16 : return "CU_RES_VIEW_FORMAT_FLOAT_1X16" ; case CU_RES_VIEW_FORMAT_FLOAT_2X16 : return "CU_RES_VIEW_FORMAT_FLOAT_2X16" ; case CU_RES_VIEW_FORMAT_FLOAT_4X16 : return "CU_RES_VIEW_FORMAT_FLOAT_4X16" ; case CU_RES_VIEW_FORMAT_FLOAT_1X32 : return "CU_RES_VIEW_FORMAT_FLOAT_1X32" ; case CU_RES_VIEW_FORMAT_FLOAT_2X32 : return "CU_RES_VIEW_FORMAT_FLOAT_2X32" ; case CU_RES_VIEW_FORMAT_FLOAT_4X32 : return "CU_RES_VIEW_FORMAT_FLOAT_4X32" ; case CU_RES_VIEW_FORMAT_UNSIGNED_BC1 : return "CU_RES_VIEW_FORMAT_UNSIGNED_BC1" ; case CU_RES_VIEW_FORMAT_UNSIGNED_BC2 : return "CU_RES_VIEW_FORMAT_UNSIGNED_BC2" ; case CU_RES_VIEW_FORMAT_UNSIGNED_BC3 : return "CU_RES_VIEW_FORMAT_UNSIGNED_BC3" ; case CU_RES_VIEW_FORMAT_UNSIGNED_BC4 : return "CU_RES_VIEW_FORMAT_UNSIGNED_BC4" ; case CU_RES_VIEW_FORMAT_SIGNED_BC4 : return "CU_RES_VIEW_FORMAT_SIGNED_BC4" ; case CU_RES_VIEW_FORMAT_UNSIGNED_BC5 : return "CU_RES_VIEW_FORMAT_UNSIGNED_BC5" ; case CU_RES_VIEW_FORMAT_SIGNED_BC5 : return "CU_RES_VIEW_FORMAT_SIGNED_BC5" ; case CU_RES_VIEW_FORMAT_UNSIGNED_BC6H : return "CU_RES_VIEW_FORMAT_UNSIGNED_BC6H" ; case CU_RES_VIEW_FORMAT_SIGNED_BC6H : return "CU_RES_VIEW_FORMAT_SIGNED_BC6H" ; case CU_RES_VIEW_FORMAT_UNSIGNED_BC7 : return "CU_RES_VIEW_FORMAT_UNSIGNED_BC7" ; } return "INVALID CUresourceViewFormat: " + n ; }
Returns the String identifying the given CUresourceViewFormat
4,036
public static String stringFor ( int n ) { switch ( n ) { case CU_JIT_MAX_REGISTERS : return "CU_JIT_MAX_REGISTERS" ; case CU_JIT_THREADS_PER_BLOCK : return "CU_JIT_THREADS_PER_BLOCK" ; case CU_JIT_WALL_TIME : return "CU_JIT_WALL_TIME" ; case CU_JIT_INFO_LOG_BUFFER : return "CU_JIT_INFO_LOG_BUFFER" ; case CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES : return "CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES" ; case CU_JIT_ERROR_LOG_BUFFER : return "CU_JIT_ERROR_LOG_BUFFER" ; case CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES : return "CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES" ; case CU_JIT_OPTIMIZATION_LEVEL : return "CU_JIT_OPTIMIZATION_LEVEL" ; case CU_JIT_TARGET_FROM_CUCONTEXT : return "CU_JIT_TARGET_FROM_CUCONTEXT" ; case CU_JIT_TARGET : return "CU_JIT_TARGET" ; case CU_JIT_FALLBACK_STRATEGY : return "CU_JIT_FALLBACK_STRATEGY" ; case CU_JIT_GENERATE_DEBUG_INFO : return "CU_JIT_GENERATE_DEBUG_INFO" ; case CU_JIT_LOG_VERBOSE : return "CU_JIT_LOG_VERBOSE" ; case CU_JIT_GENERATE_LINE_INFO : return "CU_JIT_GENERATE_LINE_INFO" ; case CU_JIT_CACHE_MODE : return "CU_JIT_CACHE_MODE" ; case CU_JIT_GLOBAL_SYMBOL_NAMES : return "CU_JIT_GLOBAL_SYMBOL_NAMES" ; case CU_JIT_GLOBAL_SYMBOL_ADDRESSES : return "CU_JIT_GLOBAL_SYMBOL_ADDRESSES" ; case CU_JIT_GLOBAL_SYMBOL_COUNT : return "CU_JIT_GLOBAL_SYMBOL_COUNT" ; } return "INVALID CUjit_option: " + n ; }
Returns the String identifying the given CUjit_option
4,037
private static int checkResult ( int result ) { if ( exceptionsEnabled && result != nvrtcResult . NVRTC_SUCCESS ) { throw new CudaException ( nvrtcResult . stringFor ( result ) ) ; } return result ; }
If the given result is different to nvrtcResult . NVRTC_SUCCESS and exceptions have been enabled this method will throw a CudaException with an error message that corresponds to the given result code . Otherwise the given result is simply returned .
4,038
public void setName ( String nameString ) { byte bytes [ ] = nameString . getBytes ( ) ; int n = Math . min ( name . length , bytes . length ) ; System . arraycopy ( bytes , 0 , name , 0 , n ) ; }
Set the name of this cudaDeviceProp to the given name
4,039
private static String createString ( byte bytes [ ] ) { StringBuilder sb = new StringBuilder ( ) ; if ( bytes == null ) { sb . append ( "null" ) ; } else { for ( byte b : bytes ) { if ( Character . isLetterOrDigit ( b ) || Character . isWhitespace ( b ) ) { sb . append ( ( char ) b ) ; } } } return sb . toString ( ) ; }
Creates a String from the letter digit and whitespace characters in the given byte array
4,040
private static String createByteString ( byte bytes [ ] ) { StringBuilder sb = new StringBuilder ( ) ; if ( bytes == null ) { sb . append ( "null" ) ; } else { for ( byte b : bytes ) { sb . append ( String . format ( "%02x" , b ) ) ; } } return sb . toString ( ) ; }
Creates a String containing the hex representation of the given bytes
4,041
public static String stringFor ( int m ) { switch ( m ) { case cudaResViewFormatNone : return "cudaResViewFormatNone" ; case cudaResViewFormatUnsignedChar1 : return "cudaResViewFormatUnsignedChar1" ; case cudaResViewFormatUnsignedChar2 : return "cudaResViewFormatUnsignedChar2" ; case cudaResViewFormatUnsignedChar4 : return "cudaResViewFormatUnsignedChar4" ; case cudaResViewFormatSignedChar1 : return "cudaResViewFormatSignedChar1" ; case cudaResViewFormatSignedChar2 : return "cudaResViewFormatSignedChar2" ; case cudaResViewFormatSignedChar4 : return "cudaResViewFormatSignedChar4" ; case cudaResViewFormatUnsignedShort1 : return "cudaResViewFormatUnsignedShort1" ; case cudaResViewFormatUnsignedShort2 : return "cudaResViewFormatUnsignedShort2" ; case cudaResViewFormatUnsignedShort4 : return "cudaResViewFormatUnsignedShort4" ; case cudaResViewFormatSignedShort1 : return "cudaResViewFormatSignedShort1" ; case cudaResViewFormatSignedShort2 : return "cudaResViewFormatSignedShort2" ; case cudaResViewFormatSignedShort4 : return "cudaResViewFormatSignedShort4" ; case cudaResViewFormatUnsignedInt1 : return "cudaResViewFormatUnsignedInt1" ; case cudaResViewFormatUnsignedInt2 : return "cudaResViewFormatUnsignedInt2" ; case cudaResViewFormatUnsignedInt4 : return "cudaResViewFormatUnsignedInt4" ; case cudaResViewFormatSignedInt1 : return "cudaResViewFormatSignedInt1" ; case cudaResViewFormatSignedInt2 : return "cudaResViewFormatSignedInt2" ; case cudaResViewFormatSignedInt4 : return "cudaResViewFormatSignedInt4" ; case cudaResViewFormatHalf1 : return "cudaResViewFormatHalf1" ; case cudaResViewFormatHalf2 : return "cudaResViewFormatHalf2" ; case cudaResViewFormatHalf4 : return "cudaResViewFormatHalf4" ; case cudaResViewFormatFloat1 : return "cudaResViewFormatFloat1" ; case cudaResViewFormatFloat2 : return "cudaResViewFormatFloat2" ; case cudaResViewFormatFloat4 : return "cudaResViewFormatFloat4" ; case cudaResViewFormatUnsignedBlockCompressed1 : return "cudaResViewFormatUnsignedBlockCompressed1" ; case cudaResViewFormatUnsignedBlockCompressed2 : return "cudaResViewFormatUnsignedBlockCompressed2" ; case cudaResViewFormatUnsignedBlockCompressed3 : return "cudaResViewFormatUnsignedBlockCompressed3" ; case cudaResViewFormatUnsignedBlockCompressed4 : return "cudaResViewFormatUnsignedBlockCompressed4" ; case cudaResViewFormatSignedBlockCompressed4 : return "cudaResViewFormatSignedBlockCompressed4" ; case cudaResViewFormatUnsignedBlockCompressed5 : return "cudaResViewFormatUnsignedBlockCompressed5" ; case cudaResViewFormatSignedBlockCompressed5 : return "cudaResViewFormatSignedBlockCompressed5" ; case cudaResViewFormatUnsignedBlockCompressed6H : return "cudaResViewFormatUnsignedBlockCompressed6H" ; case cudaResViewFormatSignedBlockCompressed6H : return "cudaResViewFormatSignedBlockCompressed6H" ; case cudaResViewFormatUnsignedBlockCompressed7 : return "cudaResViewFormatUnsignedBlockCompressed7" ; } return "INVALID cudaResourceViewFormat: " + m ; }
Returns the String identifying the given cudaResourceViewFormat
4,042
public static String stringFor ( int n ) { switch ( n ) { case CUDA_R_16F : return "CUDA_R_16F" ; case CUDA_C_16F : return "CUDA_C_16F" ; case CUDA_R_32F : return "CUDA_R_32F" ; case CUDA_C_32F : return "CUDA_C_32F" ; case CUDA_R_64F : return "CUDA_R_64F" ; case CUDA_C_64F : return "CUDA_C_64F" ; case CUDA_R_8I : return "CUDA_R_8I" ; case CUDA_C_8I : return "CUDA_C_8I" ; case CUDA_R_8U : return "CUDA_R_8U" ; case CUDA_C_8U : return "CUDA_C_8U" ; case CUDA_R_32I : return "CUDA_R_32I" ; case CUDA_C_32I : return "CUDA_C_32I" ; case CUDA_R_32U : return "CUDA_R_32U" ; case CUDA_C_32U : return "CUDA_C_32U" ; } return "INVALID cudaDataType: " + n ; }
Returns the String identifying the given cudaDataType
4,043
public static String stringFor ( int n ) { if ( n == 0 ) { return "CU_STREAM_WRITE_VALUE_DEFAULT" ; } String result = "" ; if ( ( n & CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER ) != 0 ) result += "CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER " ; return result ; }
Returns the String identifying the given CUstreamWriteValue_flags
4,044
int [ ] getKeys ( ) { Set < Integer > keySet = map . keySet ( ) ; int keys [ ] = new int [ keySet . size ( ) ] ; int index = 0 ; for ( Integer key : keySet ) { keys [ index ] = key ; index ++ ; } return keys ; }
Package private method to obtain the keys stored in these options . Also used on native side .
4,045
public static String stringFor ( int result ) { switch ( result ) { case NVRTC_SUCCESS : return "NVRTC_SUCCESS" ; case NVRTC_ERROR_OUT_OF_MEMORY : return "NVRTC_ERROR_OUT_OF_MEMORY" ; case NVRTC_ERROR_PROGRAM_CREATION_FAILURE : return "NVRTC_ERROR_PROGRAM_CREATION_FAILURE" ; case NVRTC_ERROR_INVALID_INPUT : return "NVRTC_ERROR_INVALID_INPUT" ; case NVRTC_ERROR_INVALID_PROGRAM : return "NVRTC_ERROR_INVALID_PROGRAM" ; case NVRTC_ERROR_INVALID_OPTION : return "NVRTC_ERROR_INVALID_OPTION" ; case NVRTC_ERROR_COMPILATION : return "NVRTC_ERROR_COMPILATION" ; case NVRTC_ERROR_BUILTIN_OPERATION_FAILURE : return "NVRTC_ERROR_BUILTIN_OPERATION_FAILURE" ; case NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION : return "NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION" ; case NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION : return "NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION" ; case NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID : return "NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID" ; case NVRTC_ERROR_INTERNAL_ERROR : return "NVRTC_ERROR_INTERNAL_ERROR" ; case JCUDA_INTERNAL_ERROR : return "JCUDA_INTERNAL_ERROR" ; } return "INVALID nvrtcResult: " + result ; }
Returns the String identifying the given nvrtcResult
4,046
public static String stringFor ( int n ) { switch ( n ) { case CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK : return "CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK" ; case CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES : return "CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES" ; case CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES : return "CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES" ; case CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES : return "CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES" ; case CU_FUNC_ATTRIBUTE_NUM_REGS : return "CU_FUNC_ATTRIBUTE_NUM_REGS" ; case CU_FUNC_ATTRIBUTE_PTX_VERSION : return "CU_FUNC_ATTRIBUTE_PTX_VERSION" ; case CU_FUNC_ATTRIBUTE_BINARY_VERSION : return "CU_FUNC_ATTRIBUTE_BINARY_VERSION" ; case CU_FUNC_ATTRIBUTE_CACHE_MODE_CA : return "CU_FUNC_ATTRIBUTE_CACHE_MODE_CA" ; case CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES : return "CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES" ; case CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT : return "CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT" ; } return "INVALID CUfunction_attribute: " + n ; }
Returns the String identifying the given CUfunction_attribute
4,047
public static String stringFor ( int k ) { switch ( k ) { case cudaMemcpyHostToHost : return "cudaMemcpyHostToHost" ; case cudaMemcpyHostToDevice : return "cudaMemcpyHostToDevice" ; case cudaMemcpyDeviceToHost : return "cudaMemcpyDeviceToHost" ; case cudaMemcpyDeviceToDevice : return "cudaMemcpyDeviceToDevice" ; case cudaMemcpyDefault : return "cudaMemcpyDefault" ; } return "INVALID cudaMemcpyKind: " + k ; }
Returns the String identifying the given cudaMemcpyKind
4,048
public static String stringFor ( int n ) { switch ( n ) { case cudaGraphicsRegisterFlagsNone : return "cudaGraphicsRegisterFlagsNone" ; case cudaGraphicsRegisterFlagsReadOnly : return "cudaGraphicsRegisterFlagsReadOnly" ; case cudaGraphicsRegisterFlagsWriteDiscard : return "cudaGraphicsRegisterFlagsWriteDiscard" ; case cudaGraphicsRegisterFlagsSurfaceLoadStore : return "cudaGraphicsRegisterFlagsSurfaceLoadStore" ; case cudaGraphicsRegisterFlagsTextureGather : return "cudaGraphicsRegisterFlagsTextureGather" ; } return "INVALID cudaGraphicsRegisterFlags: " + n ; }
Returns the String identifying the given cudaGraphicsRegisterFlags
4,049
public static String stringFor ( int n ) { switch ( n ) { case CU_POINTER_ATTRIBUTE_CONTEXT : return "CU_POINTER_ATTRIBUTE_CONTEXT" ; case CU_POINTER_ATTRIBUTE_MEMORY_TYPE : return "CU_POINTER_ATTRIBUTE_MEMORY_TYPE" ; case CU_POINTER_ATTRIBUTE_DEVICE_POINTER : return "CU_POINTER_ATTRIBUTE_DEVICE_POINTER" ; case CU_POINTER_ATTRIBUTE_HOST_POINTER : return "CU_POINTER_ATTRIBUTE_HOST_POINTER" ; case CU_POINTER_ATTRIBUTE_P2P_TOKENS : return "CU_POINTER_ATTRIBUTE_P2P_TOKENS" ; case CU_POINTER_ATTRIBUTE_SYNC_MEMOPS : return "CU_POINTER_ATTRIBUTE_SYNC_MEMOPS" ; case CU_POINTER_ATTRIBUTE_BUFFER_ID : return "CU_POINTER_ATTRIBUTE_BUFFER_ID" ; case CU_POINTER_ATTRIBUTE_IS_MANAGED : return "CU_POINTER_ATTRIBUTE_IS_MANAGED" ; case CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL : return "CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL" ; } return "INVALID CUpointer_attribute: " + n ; }
Returns the String identifying the given CUpointer_attribute
4,050
public static String stringFor ( int n ) { switch ( n ) { case CU_CUBEMAP_FACE_POSITIVE_X : return "CU_CUBEMAP_FACE_POSITIVE_X" ; case CU_CUBEMAP_FACE_NEGATIVE_X : return "CU_CUBEMAP_FACE_NEGATIVE_X" ; case CU_CUBEMAP_FACE_POSITIVE_Y : return "CU_CUBEMAP_FACE_POSITIVE_Y" ; case CU_CUBEMAP_FACE_NEGATIVE_Y : return "CU_CUBEMAP_FACE_NEGATIVE_Y" ; case CU_CUBEMAP_FACE_POSITIVE_Z : return "CU_CUBEMAP_FACE_POSITIVE_Z" ; case CU_CUBEMAP_FACE_NEGATIVE_Z : return "CU_CUBEMAP_FACE_NEGATIVE_Z" ; } return "INVALID CUarray_cubemap_face: " + n ; }
Returns the String identifying the given CUarray_cubemap_face
4,051
public static String stringFor ( int n ) { if ( n == 0 ) { return "CU_STREAM_DEFAULT" ; } String result = "" ; if ( ( n & CU_STREAM_NON_BLOCKING ) != 0 ) result += "CU_STREAM_NON_BLOCKING " ; return result ; }
Returns the String identifying the given CUstream_flags
4,052
public static String stringFor ( int n ) { switch ( n ) { case CU_TARGET_COMPUTE_10 : return "CU_TARGET_COMPUTE_10" ; case CU_TARGET_COMPUTE_11 : return "CU_TARGET_COMPUTE_11" ; case CU_TARGET_COMPUTE_12 : return "CU_TARGET_COMPUTE_12" ; case CU_TARGET_COMPUTE_13 : return "CU_TARGET_COMPUTE_13" ; case CU_TARGET_COMPUTE_20 : return "CU_TARGET_COMPUTE_20" ; case CU_TARGET_COMPUTE_21 : return "CU_TARGET_COMPUTE_21" ; case CU_TARGET_COMPUTE_30 : return "CU_TARGET_COMPUTE_30" ; case CU_TARGET_COMPUTE_32 : return "CU_TARGET_COMPUTE_32" ; case CU_TARGET_COMPUTE_35 : return "CU_TARGET_COMPUTE_35" ; case CU_TARGET_COMPUTE_37 : return "CU_TARGET_COMPUTE_37" ; case CU_TARGET_COMPUTE_50 : return "CU_TARGET_COMPUTE_50" ; case CU_TARGET_COMPUTE_52 : return "CU_TARGET_COMPUTE_52" ; case CU_TARGET_COMPUTE_53 : return "CU_TARGET_COMPUTE_53" ; case CU_TARGET_COMPUTE_60 : return "CU_TARGET_COMPUTE_60" ; case CU_TARGET_COMPUTE_61 : return "CU_TARGET_COMPUTE_61" ; case CU_TARGET_COMPUTE_62 : return "CU_TARGET_COMPUTE_62" ; case CU_TARGET_COMPUTE_70 : return "CU_TARGET_COMPUTE_70" ; case CU_TARGET_COMPUTE_73 : return "CU_TARGET_COMPUTE_73" ; case CU_TARGET_COMPUTE_75 : return "CU_TARGET_COMPUTE_75" ; } return "INVALID CUjit_target: " + n ; }
Returns the String identifying the given CUjit_target
4,053
private static void loadLibraryResource ( String resourceSubdirectoryName , String libraryName , String tempSubdirectoryName , String ... dependentLibraryNames ) throws Throwable { for ( String dependentLibraryName : dependentLibraryNames ) { logger . log ( level , "Library " + libraryName + " depends on " + dependentLibraryName ) ; String dependentResourceSubdirectoryName = resourceSubdirectoryName + "/" + osString ( ) + "/" + archString ( ) ; String dependentLibraryTempSubDirectoryName = libraryName + "_dependents" + File . separator + osString ( ) + File . separator + archString ( ) + File . separator ; loadLibraryResource ( dependentResourceSubdirectoryName , dependentLibraryName , dependentLibraryTempSubDirectoryName ) ; } String libraryFileName = createLibraryFileName ( libraryName ) ; File libraryTempFile = createTempFile ( tempSubdirectoryName , libraryFileName ) ; if ( ! libraryTempFile . exists ( ) ) { String libraryResourceName = resourceSubdirectoryName + "/" + libraryFileName ; logger . log ( level , "Writing resource " + libraryResourceName ) ; logger . log ( level , "to temporary file " + libraryTempFile ) ; writeResourceToFile ( libraryResourceName , libraryTempFile ) ; } logger . log ( level , "Loading library " + libraryTempFile ) ; System . load ( libraryTempFile . toString ( ) ) ; logger . log ( level , "Loading library " + libraryTempFile + " DONE" ) ; }
Load the library with the given name from a resource .
4,054
private static File createTempFile ( String tempSubdirectoryName , String name ) throws IOException { String tempDirName = System . getProperty ( "java.io.tmpdir" ) ; File tempSubDirectory = new File ( tempDirName + File . separator + tempSubdirectoryName ) ; if ( ! tempSubDirectory . exists ( ) ) { boolean createdDirectory = tempSubDirectory . mkdirs ( ) ; if ( ! createdDirectory ) { throw new IOException ( "Could not create directory for temporary file: " + tempSubDirectory ) ; } } String tempFileName = tempSubDirectory + File . separator + name ; File tempFile = new File ( tempFileName ) ; return tempFile ; }
Create a file object representing the file with the given name in the specified subdirectory of the default temp directory . If the specified subdirectory does not exist yet it is created .
4,055
public static OSType calculateOS ( ) { String vendor = System . getProperty ( "java.vendor" ) ; if ( "The Android Project" . equals ( vendor ) ) { return OSType . ANDROID ; } String osName = System . getProperty ( "os.name" ) ; osName = osName . toLowerCase ( Locale . ENGLISH ) ; if ( osName . startsWith ( "mac os" ) ) { return OSType . APPLE ; } if ( osName . startsWith ( "windows" ) ) { return OSType . WINDOWS ; } if ( osName . startsWith ( "linux" ) ) { return OSType . LINUX ; } if ( osName . startsWith ( "sun" ) ) { return OSType . SUN ; } return OSType . UNKNOWN ; }
Calculates the current OSType
4,056
public static ArchType calculateArch ( ) { String osArch = System . getProperty ( "os.arch" ) ; osArch = osArch . toLowerCase ( Locale . ENGLISH ) ; if ( "i386" . equals ( osArch ) || "x86" . equals ( osArch ) || "i686" . equals ( osArch ) ) { return ArchType . X86 ; } if ( osArch . startsWith ( "amd64" ) || osArch . startsWith ( "x86_64" ) ) { return ArchType . X86_64 ; } if ( osArch . startsWith ( "arm64" ) ) { return ArchType . ARM64 ; } if ( osArch . startsWith ( "arm" ) ) { return ArchType . ARM ; } if ( "ppc" . equals ( osArch ) || "powerpc" . equals ( osArch ) ) { return ArchType . PPC ; } if ( osArch . startsWith ( "ppc" ) ) { return ArchType . PPC_64 ; } if ( osArch . startsWith ( "sparc" ) ) { return ArchType . SPARC ; } if ( osArch . startsWith ( "mips64" ) ) { return ArchType . MIPS64 ; } if ( osArch . startsWith ( "mips" ) ) { return ArchType . MIPS ; } if ( osArch . contains ( "risc" ) ) { return ArchType . RISC ; } if ( osArch . startsWith ( "aarch64" ) ) { return ArchType . AARCH64 ; } return ArchType . UNKNOWN ; }
Calculates the current ARCHType
4,057
public static String stringFor ( int n ) { switch ( n ) { case CU_GRAPH_NODE_TYPE_KERNEL : return "CU_GRAPH_NODE_TYPE_KERNEL" ; case CU_GRAPH_NODE_TYPE_MEMCPY : return "CU_GRAPH_NODE_TYPE_MEMCPY" ; case CU_GRAPH_NODE_TYPE_MEMSET : return "CU_GRAPH_NODE_TYPE_MEMSET" ; case CU_GRAPH_NODE_TYPE_HOST : return "CU_GRAPH_NODE_TYPE_HOST" ; case CU_GRAPH_NODE_TYPE_GRAPH : return "CU_GRAPH_NODE_TYPE_GRAPH" ; case CU_GRAPH_NODE_TYPE_EMPTY : return "CU_GRAPH_NODE_TYPE_EMPTY" ; } return "INVALID CUgraphNodeType: " + n ; }
Returns the String identifying the given CUgraphNodeType
4,058
public static String stringFor ( int result ) { switch ( result ) { case CUDA_SUCCESS : return "CUDA_SUCCESS" ; case CUDA_ERROR_INVALID_VALUE : return "CUDA_ERROR_INVALID_VALUE" ; case CUDA_ERROR_OUT_OF_MEMORY : return "CUDA_ERROR_OUT_OF_MEMORY" ; case CUDA_ERROR_NOT_INITIALIZED : return "CUDA_ERROR_NOT_INITIALIZED" ; case CUDA_ERROR_DEINITIALIZED : return "CUDA_ERROR_DEINITIALIZED" ; case CUDA_ERROR_PROFILER_DISABLED : return "CUDA_ERROR_PROFILER_DISABLED" ; case CUDA_ERROR_PROFILER_NOT_INITIALIZED : return "CUDA_ERROR_PROFILER_NOT_INITIALIZED" ; case CUDA_ERROR_PROFILER_ALREADY_STARTED : return "CUDA_ERROR_PROFILER_ALREADY_STARTED" ; case CUDA_ERROR_PROFILER_ALREADY_STOPPED : return "CUDA_ERROR_PROFILER_ALREADY_STOPPED" ; case CUDA_ERROR_NO_DEVICE : return "CUDA_ERROR_NO_DEVICE" ; case CUDA_ERROR_INVALID_DEVICE : return "CUDA_ERROR_INVALID_DEVICE" ; case CUDA_ERROR_INVALID_IMAGE : return "CUDA_ERROR_INVALID_IMAGE" ; case CUDA_ERROR_INVALID_CONTEXT : return "CUDA_ERROR_INVALID_CONTEXT" ; case CUDA_ERROR_CONTEXT_ALREADY_CURRENT : return "CUDA_ERROR_CONTEXT_ALREADY_CURRENT" ; case CUDA_ERROR_MAP_FAILED : return "CUDA_ERROR_MAP_FAILED" ; case CUDA_ERROR_UNMAP_FAILED : return "CUDA_ERROR_UNMAP_FAILED" ; case CUDA_ERROR_ARRAY_IS_MAPPED : return "CUDA_ERROR_ARRAY_IS_MAPPED" ; case CUDA_ERROR_ALREADY_MAPPED : return "CUDA_ERROR_ALREADY_MAPPED" ; case CUDA_ERROR_NO_BINARY_FOR_GPU : return "CUDA_ERROR_NO_BINARY_FOR_GPU" ; case CUDA_ERROR_ALREADY_ACQUIRED : return "CUDA_ERROR_ALREADY_ACQUIRED" ; case CUDA_ERROR_NOT_MAPPED : return "CUDA_ERROR_NOT_MAPPED" ; case CUDA_ERROR_NOT_MAPPED_AS_ARRAY : return "CUDA_ERROR_NOT_MAPPED_AS_ARRAY" ; case CUDA_ERROR_NOT_MAPPED_AS_POINTER : return "CUDA_ERROR_NOT_MAPPED_AS_POINTER" ; case CUDA_ERROR_ECC_UNCORRECTABLE : return "CUDA_ERROR_ECC_UNCORRECTABLE" ; case CUDA_ERROR_UNSUPPORTED_LIMIT : return "CUDA_ERROR_UNSUPPORTED_LIMIT" ; case CUDA_ERROR_CONTEXT_ALREADY_IN_USE : return "CUDA_ERROR_CONTEXT_ALREADY_IN_USE" ; case CUDA_ERROR_PEER_ACCESS_UNSUPPORTED : return "CUDA_ERROR_PEER_ACCESS_UNSUPPORTED" ; case CUDA_ERROR_INVALID_PTX : return "CUDA_ERROR_INVALID_PTX" ; case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT : return "CUDA_ERROR_INVALID_GRAPHICS_CONTEXT" ; case CUDA_ERROR_NVLINK_UNCORRECTABLE : return "CUDA_ERROR_NVLINK_UNCORRECTABLE" ; case CUDA_ERROR_JIT_COMPILER_NOT_FOUND : return "CUDA_ERROR_JIT_COMPILER_NOT_FOUND" ; case CUDA_ERROR_INVALID_SOURCE : return "CUDA_ERROR_INVALID_SOURCE" ; case CUDA_ERROR_FILE_NOT_FOUND : return "CUDA_ERROR_FILE_NOT_FOUND" ; case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND : return "CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND" ; case CUDA_ERROR_SHARED_OBJECT_INIT_FAILED : return "CUDA_ERROR_SHARED_OBJECT_INIT_FAILED" ; case CUDA_ERROR_OPERATING_SYSTEM : return "CUDA_ERROR_OPERATING_SYSTEM" ; case CUDA_ERROR_INVALID_HANDLE : return "CUDA_ERROR_INVALID_HANDLE" ; case CUDA_ERROR_ILLEGAL_STATE : return "CUDA_ERROR_ILLEGAL_STATE" ; case CUDA_ERROR_NOT_FOUND : return "CUDA_ERROR_NOT_FOUND" ; case CUDA_ERROR_NOT_READY : return "CUDA_ERROR_NOT_READY" ; case CUDA_ERROR_ILLEGAL_ADDRESS : return "CUDA_ERROR_ILLEGAL_ADDRESS" ; case CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES : return "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES" ; case CUDA_ERROR_LAUNCH_TIMEOUT : return "CUDA_ERROR_LAUNCH_TIMEOUT" ; case CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING : return "CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING" ; case CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED : return "CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED" ; case CUDA_ERROR_PEER_ACCESS_NOT_ENABLED : return "CUDA_ERROR_PEER_ACCESS_NOT_ENABLED" ; case CUDA_ERROR_PEER_MEMORY_ALREADY_REGISTERED : return "CUDA_ERROR_PEER_MEMORY_ALREADY_REGISTERED" ; case CUDA_ERROR_PEER_MEMORY_NOT_REGISTERED : return "CUDA_ERROR_PEER_MEMORY_NOT_REGISTERED" ; case CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE : return "CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE" ; case CUDA_ERROR_CONTEXT_IS_DESTROYED : return "CUDA_ERROR_CONTEXT_IS_DESTROYED" ; case CUDA_ERROR_ASSERT : return "CUDA_ERROR_ASSERT" ; case CUDA_ERROR_TOO_MANY_PEERS : return "CUDA_ERROR_TOO_MANY_PEERS" ; case CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED : return "CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED" ; case CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED : return "CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED" ; case CUDA_ERROR_HARDWARE_STACK_ERROR : return "CUDA_ERROR_HARDWARE_STACK_ERROR" ; case CUDA_ERROR_ILLEGAL_INSTRUCTION : return "CUDA_ERROR_ILLEGAL_INSTRUCTION" ; case CUDA_ERROR_MISALIGNED_ADDRESS : return "CUDA_ERROR_MISALIGNED_ADDRESS" ; case CUDA_ERROR_INVALID_ADDRESS_SPACE : return "CUDA_ERROR_INVALID_ADDRESS_SPACE" ; case CUDA_ERROR_INVALID_PC : return "CUDA_ERROR_INVALID_PC" ; case CUDA_ERROR_LAUNCH_FAILED : return "CUDA_ERROR_LAUNCH_FAILED" ; case CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE : return "CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE" ; case CUDA_ERROR_NOT_PERMITTED : return "CUDA_ERROR_NOT_PERMITTED" ; case CUDA_ERROR_NOT_SUPPORTED : return "CUDA_ERROR_NOT_SUPPORTED" ; case CUDA_ERROR_SYSTEM_NOT_READY : return "CUDA_ERROR_SYSTEM_NOT_READY" ; case CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED : return "CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED" ; case CUDA_ERROR_STREAM_CAPTURE_INVALIDATED : return "CUDA_ERROR_STREAM_CAPTURE_INVALIDATED" ; case CUDA_ERROR_STREAM_CAPTURE_MERGE : return "CUDA_ERROR_STREAM_CAPTURE_MERGE" ; case CUDA_ERROR_STREAM_CAPTURE_UNMATCHED : return "CUDA_ERROR_STREAM_CAPTURE_UNMATCHED" ; case CUDA_ERROR_STREAM_CAPTURE_UNJOINED : return "CUDA_ERROR_STREAM_CAPTURE_UNJOINED" ; case CUDA_ERROR_STREAM_CAPTURE_ISOLATION : return "CUDA_ERROR_STREAM_CAPTURE_ISOLATION" ; case CUDA_ERROR_STREAM_CAPTURE_IMPLICIT : return "CUDA_ERROR_STREAM_CAPTURE_IMPLICIT" ; case CUDA_ERROR_CAPTURED_EVENT : return "CUDA_ERROR_CAPTURED_EVENT" ; case CUDA_ERROR_UNKNOWN : return "CUDA_ERROR_UNKNOWN" ; } return "INVALID CUresult: " + result ; }
Returns the String identifying the given CUresult
4,059
public static String stringFor ( int n ) { switch ( n ) { case cudaGraphicsCubeFacePositiveX : return "cudaGraphicsCubeFacePositiveX" ; case cudaGraphicsCubeFaceNegativeX : return "cudaGraphicsCubeFaceNegativeX" ; case cudaGraphicsCubeFacePositiveY : return "cudaGraphicsCubeFacePositiveY" ; case cudaGraphicsCubeFaceNegativeY : return "cudaGraphicsCubeFaceNegativeY" ; case cudaGraphicsCubeFacePositiveZ : return "cudaGraphicsCubeFacePositiveZ" ; case cudaGraphicsCubeFaceNegativeZ : return "cudaGraphicsCubeFaceNegativeZ" ; } return "INVALID cudaGraphicsCubeFace: " + n ; }
Returns the String identifying the given cudaGraphicsCubeFace
4,060
public static String stringFor ( int n ) { if ( n == 0 ) { return "CU_GRAPHICS_REGISTER_FLAGS_NONE" ; } String result = "" ; if ( ( n & CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY ) != 0 ) result += "CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY " ; if ( ( n & CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD ) != 0 ) result += "CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD " ; if ( ( n & CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST ) != 0 ) result += "CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST " ; if ( ( n & CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER ) != 0 ) result += "CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER " ; return result ; }
Returns the String identifying the given CUgraphicsRegisterFlags
4,061
public static String stringFor ( int n ) { switch ( n ) { case CU_AD_FORMAT_UNSIGNED_INT8 : return "CU_AD_FORMAT_UNSIGNED_INT8" ; case CU_AD_FORMAT_UNSIGNED_INT16 : return "CU_AD_FORMAT_UNSIGNED_INT16" ; case CU_AD_FORMAT_UNSIGNED_INT32 : return "CU_AD_FORMAT_UNSIGNED_INT32" ; case CU_AD_FORMAT_SIGNED_INT8 : return "CU_AD_FORMAT_SIGNED_INT8" ; case CU_AD_FORMAT_SIGNED_INT16 : return "CU_AD_FORMAT_SIGNED_INT16" ; case CU_AD_FORMAT_SIGNED_INT32 : return "CU_AD_FORMAT_SIGNED_INT32" ; case CU_AD_FORMAT_HALF : return "CU_AD_FORMAT_HALF" ; case CU_AD_FORMAT_FLOAT : return "CU_AD_FORMAT_FLOAT" ; } return "INVALID CUarray_format: " + n ; }
Returns the String identifying the given CUarray_format
4,062
public static String stringFor ( int n ) { if ( n == 0 ) { return "INVALID CUipcMem_flags: " + n ; } String result = "" ; if ( ( n & CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS ) != 0 ) result += "CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS" ; return result ; }
Returns the String identifying the given CUipcMem_flags
4,063
public static String stringFor ( int n ) { if ( n == 0 ) { return "INVALID CUmemAttach_flags: " + n ; } String result = "" ; if ( ( n & CU_MEM_ATTACH_GLOBAL ) != 0 ) result += "CU_MEM_ATTACH_GLOBAL " ; if ( ( n & CU_MEM_ATTACH_HOST ) != 0 ) result += "CU_MEM_ATTACH_HOST " ; if ( ( n & CU_MEM_ATTACH_SINGLE ) != 0 ) result += "CU_MEM_ATTACH_SINGLE " ; return result ; }
Returns the String identifying the given CUmemAttach_flags
4,064
public static String stringFor ( int n ) { switch ( n ) { case CU_CTX_SCHED_AUTO : return "CU_CTX_SCHED_AUTO" ; case CU_CTX_SCHED_SPIN : return "CU_CTX_SCHED_SPIN" ; case CU_CTX_SCHED_YIELD : return "CU_CTX_SCHED_YIELD" ; case CU_CTX_BLOCKING_SYNC : return "CU_CTX_BLOCKING_SYNC" ; case CU_CTX_MAP_HOST : return "CU_CTX_MAP_HOST" ; case CU_CTX_LMEM_RESIZE_TO_MAX : return "CU_CTX_LMEM_RESIZE_TO_MAX" ; case CU_CTX_FLAGS_MASK : return "[CU_CTX_FLAGS_MASK]" ; case CU_CTX_SCHED_MASK : return "[CU_CTX_SCHED_MASK]" ; } return "INVALID CUctx_flags: " + n ; }
Returns the String identifying the given CUctx_flags
4,065
public static String stringFor ( int n ) { if ( n == 0 ) { return "CU_GL_MAP_RESOURCE_FLAGS_NONE" ; } String result = "" ; if ( ( n & CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY ) != 0 ) result += "CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY " ; if ( ( n & CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD ) != 0 ) result += "CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD " ; return result ; }
Returns the String identifying the given CUGLmap_flags
4,066
public static String stringFor ( int n ) { switch ( n ) { case cudaLimitStackSize : return "cudaLimitStackSize" ; case cudaLimitPrintfFifoSize : return "cudaLimitPrintfFifoSize" ; case cudaLimitMallocHeapSize : return "cudaLimitMallocHeapSize" ; case cudaLimitDevRuntimeSyncDepth : return "cudaLimitDevRuntimeSyncDepth" ; case cudaLimitDevRuntimePendingLaunchCount : return "cudaLimitDevRuntimePendingLaunchCount" ; case cudaLimitMaxL2FetchGranularity : return "cudaLimitMaxL2FetchGranularity" ; } return "INVALID cudaLimit: " + n ; }
Returns the String identifying the given cudaLimit
4,067
public static String stringFor ( int n ) { switch ( n ) { case CU_LIMIT_STACK_SIZE : return "CU_LIMIT_STACK_SIZE" ; case CU_LIMIT_PRINTF_FIFO_SIZE : return "CU_LIMIT_PRINTF_FIFO_SIZE" ; case CU_LIMIT_MALLOC_HEAP_SIZE : return "CU_LIMIT_MALLOC_HEAP_SIZE" ; case CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH : return "CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH" ; case CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT : return "CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT" ; case CU_LIMIT_MAX_L2_FETCH_GRANULARITY : return "CU_LIMIT_MAX_L2_FETCH_GRANULARITY" ; } return "INVALID CUlimit: " + n ; }
Returns the String identifying the given CUlimit
4,068
public static String stringFor ( int n ) { switch ( n ) { case CU_MEM_ADVISE_SET_READ_MOSTLY : return "CU_MEM_ADVISE_SET_READ_MOSTLY" ; case CU_MEM_ADVISE_UNSET_READ_MOSTLY : return "CU_MEM_ADVISE_UNSET_READ_MOSTLY" ; case CU_MEM_ADVISE_SET_PREFERRED_LOCATION : return "CU_MEM_ADVISE_SET_PREFERRED_LOCATION" ; case CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION : return "CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION" ; case CU_MEM_ADVISE_SET_ACCESSED_BY : return "CU_MEM_ADVISE_SET_ACCESSED_BY" ; case CU_MEM_ADVISE_UNSET_ACCESSED_BY : return "CU_MEM_ADVISE_UNSET_ACCESSED_BY" ; } return "INVALID CUmem_advise: " + n ; }
Returns the String identifying the given CUmem_advise
4,069
public static String stringFor ( int n ) { if ( n == 0 ) { return "CU_EVENT_DEFAULT" ; } String result = "" ; if ( ( n & CU_EVENT_BLOCKING_SYNC ) != 0 ) result += "CU_EVENT_BLOCKING_SYNC " ; if ( ( n & CU_EVENT_DISABLE_TIMING ) != 0 ) result += "CU_EVENT_DISABLE_TIMING " ; if ( ( n & CU_EVENT_INTERPROCESS ) != 0 ) result += "CU_EVENT_INTERPROCESS " ; return result ; }
Returns the String identifying the given CUevent_flags
4,070
public static String stringFor ( int n ) { switch ( n ) { case CU_JIT_INPUT_CUBIN : return "CU_JIT_INPUT_CUBIN" ; case CU_JIT_INPUT_PTX : return "CU_JIT_INPUT_PTX" ; case CU_JIT_INPUT_FATBINARY : return "CU_JIT_INPUT_FATBINARY" ; case CU_JIT_INPUT_OBJECT : return "CU_JIT_INPUT_OBJECT" ; case CU_JIT_INPUT_LIBRARY : return "CU_JIT_INPUT_LIBRARY" ; } return "INVALID CUjitInputType: " + n ; }
Returns the String identifying the given CUjitInputType
4,071
public static String stringFor ( int k ) { switch ( k ) { case cudaMemAdviseSetReadMostly : return "cudaMemAdviseSetReadMostly" ; case cudaMemAdviseUnsetReadMostly : return "cudaMemAdviseUnsetReadMostly" ; case cudaMemAdviseSetPreferredLocation : return "cudaMemAdviseSetPreferredLocation" ; case cudaMemAdviseUnsetPreferredLocation : return "cudaMemAdviseUnsetPreferredLocation" ; case cudaMemAdviseSetAccessedBy : return "cudaMemAdviseSetAccessedBy" ; case cudaMemAdviseUnsetAccessedBy : return "cudaMemAdviseUnsetAccessedBy" ; } return "INVALID cudaMemoryAdvise: " + k ; }
Returns the String identifying the given cudaMemoryAdvise
4,072
private static int checkResult ( int result ) { if ( exceptionsEnabled && result != CUresult . CUDA_SUCCESS ) { throw new CudaException ( CUresult . stringFor ( result ) ) ; } return result ; }
If the given result is different to CUresult . CUDA_SUCCESS and exceptions have been enabled this method will throw a CudaException with an error message that corresponds to the given result code . Otherwise the given result is simply returned .
4,073
public static int cuDeviceGetName ( byte name [ ] , int len , CUdevice dev ) { return checkResult ( cuDeviceGetNameNative ( name , len , dev ) ) ; }
Returns an identifer string for the device .
4,074
public static int cuDeviceGetLuid ( byte luid [ ] , int deviceNodeMask [ ] , CUdevice dev ) { return checkResult ( cuDeviceGetLuidNative ( luid , deviceNodeMask , dev ) ) ; }
Return an LUID and device node mask for the device .
4,075
public static int cuDeviceComputeCapability ( int major [ ] , int minor [ ] , CUdevice dev ) { return checkResult ( cuDeviceComputeCapabilityNative ( major , minor , dev ) ) ; }
Returns the compute capability of the device .
4,076
public static int cuDeviceGetProperties ( CUdevprop prop , CUdevice dev ) { return checkResult ( cuDeviceGetPropertiesNative ( prop , dev ) ) ; }
Returns properties for a selected device .
4,077
public static int cuDeviceGetAttribute ( int pi [ ] , int attrib , CUdevice dev ) { return checkResult ( cuDeviceGetAttributeNative ( pi , attrib , dev ) ) ; }
Returns information about the device .
4,078
public static int cuCtxCreate ( CUcontext pctx , int flags , CUdevice dev ) { return checkResult ( cuCtxCreateNative ( pctx , flags , dev ) ) ; }
Create a CUDA context .
4,079
public static int cuModuleGetFunction ( CUfunction hfunc , CUmodule hmod , String name ) { return checkResult ( cuModuleGetFunctionNative ( hfunc , hmod , name ) ) ; }
Returns a function handle .
4,080
public static int cuModuleGetGlobal ( CUdeviceptr dptr , long bytes [ ] , CUmodule hmod , String name ) { return checkResult ( cuModuleGetGlobalNative ( dptr , bytes , hmod , name ) ) ; }
Returns a global pointer from a module .
4,081
public static int cuModuleGetTexRef ( CUtexref pTexRef , CUmodule hmod , String name ) { return checkResult ( cuModuleGetTexRefNative ( pTexRef , hmod , name ) ) ; }
Returns a handle to a texture reference .
4,082
public static int cuModuleGetSurfRef ( CUsurfref pSurfRef , CUmodule hmod , String name ) { return checkResult ( cuModuleGetSurfRefNative ( pSurfRef , hmod , name ) ) ; }
Returns a handle to a surface reference .
4,083
public static int cuMemHostAlloc ( Pointer pp , long bytes , int Flags ) { return checkResult ( cuMemHostAllocNative ( pp , bytes , Flags ) ) ; }
Allocates page - locked host memory .
4,084
public static int cuMemHostGetDevicePointer ( CUdeviceptr ret , Pointer p , int Flags ) { return checkResult ( cuMemHostGetDevicePointerNative ( ret , p , Flags ) ) ; }
Passes back device pointer of mapped pinned memory .
4,085
public static int cuMemcpy ( CUdeviceptr dst , CUdeviceptr src , long ByteCount ) { return checkResult ( cuMemcpyNative ( dst , src , ByteCount ) ) ; }
Copies memory .
4,086
public static int cuMemcpyPeer ( CUdeviceptr dstDevice , CUcontext dstContext , CUdeviceptr srcDevice , CUcontext srcContext , long ByteCount ) { return cuMemcpyPeerNative ( dstDevice , dstContext , srcDevice , srcContext , ByteCount ) ; }
Copies device memory between two contexts .
4,087
public static int cuMemAllocPitch ( CUdeviceptr dptr , long pPitch [ ] , long WidthInBytes , long Height , int ElementSizeBytes ) { return checkResult ( cuMemAllocPitchNative ( dptr , pPitch , WidthInBytes , Height , ElementSizeBytes ) ) ; }
Allocates pitched device memory .
4,088
public static int cuMemGetAddressRange ( CUdeviceptr pbase , long psize [ ] , CUdeviceptr dptr ) { return checkResult ( cuMemGetAddressRangeNative ( pbase , psize , dptr ) ) ; }
Get information on memory allocations .
4,089
public static int cuMemcpyDtoA ( CUarray dstArray , long dstIndex , CUdeviceptr srcDevice , long ByteCount ) { return checkResult ( cuMemcpyDtoANative ( dstArray , dstIndex , srcDevice , ByteCount ) ) ; }
Copies memory from Device to Array .
4,090
public static int cuMemcpyAtoD ( CUdeviceptr dstDevice , CUarray hSrc , long SrcIndex , long ByteCount ) { return checkResult ( cuMemcpyAtoDNative ( dstDevice , hSrc , SrcIndex , ByteCount ) ) ; }
Copies memory from Array to Device .
4,091
public static int cuMemcpyAtoA ( CUarray dstArray , long dstIndex , CUarray srcArray , long srcIndex , long ByteCount ) { return checkResult ( cuMemcpyAtoANative ( dstArray , dstIndex , srcArray , srcIndex , ByteCount ) ) ; }
Copies memory from Array to Array .
4,092
public static int cuMemcpyAsync ( CUdeviceptr dst , CUdeviceptr src , long ByteCount , CUstream hStream ) { return checkResult ( cuMemcpyAsyncNative ( dst , src , ByteCount , hStream ) ) ; }
Copies memory asynchronously .
4,093
public static int cuMemcpyPeerAsync ( CUdeviceptr dstDevice , CUcontext dstContext , CUdeviceptr srcDevice , CUcontext srcContext , long ByteCount , CUstream hStream ) { return checkResult ( cuMemcpyPeerAsyncNative ( dstDevice , dstContext , srcDevice , srcContext , ByteCount , hStream ) ) ; }
Copies device memory between two contexts asynchronously .
4,094
public static int cuFuncGetAttribute ( int pi [ ] , int attrib , CUfunction func ) { return checkResult ( cuFuncGetAttributeNative ( pi , attrib , func ) ) ; }
Returns information about a function .
4,095
public static int cuFuncSetBlockShape ( CUfunction hfunc , int x , int y , int z ) { return checkResult ( cuFuncSetBlockShapeNative ( hfunc , x , y , z ) ) ; }
Sets the block - dimensions for the function .
4,096
public static int cuMipmappedArrayCreate ( CUmipmappedArray pHandle , CUDA_ARRAY3D_DESCRIPTOR pMipmappedArrayDesc , int numMipmapLevels ) { return checkResult ( cuMipmappedArrayCreateNative ( pHandle , pMipmappedArrayDesc , numMipmapLevels ) ) ; }
Creates a CUDA mipmapped array .
4,097
public static int cuTexRefSetArray ( CUtexref hTexRef , CUarray hArray , int Flags ) { return checkResult ( cuTexRefSetArrayNative ( hTexRef , hArray , Flags ) ) ; }
Binds an array as a texture reference .
4,098
public static int cuTexRefSetMipmappedArray ( CUtexref hTexRef , CUmipmappedArray hMipmappedArray , int Flags ) { return checkResult ( cuTexRefSetMipmappedArrayNative ( hTexRef , hMipmappedArray , Flags ) ) ; }
Binds a mipmapped array to a texture reference .
4,099
public static int cuTexRefSetAddress ( long ByteOffset [ ] , CUtexref hTexRef , CUdeviceptr dptr , long bytes ) { return checkResult ( cuTexRefSetAddressNative ( ByteOffset , hTexRef , dptr , bytes ) ) ; }
Binds an address as a texture reference .